diff options
author | nodiscc <nodiscc@gmail.com> | 2017-01-26 18:52:54 +0100 |
---|---|---|
committer | nodiscc <nodiscc@gmail.com> | 2017-06-18 00:19:49 +0200 |
commit | 53ed6d7d1e678d7486337ce67a2f17b30bac21ac (patch) | |
tree | f8bef0164a70bd03d2b9781951c01bdd018f1842 /doc/html/Unit-tests | |
parent | d5d22a6d07917865c44148ad76f43c65a929a890 (diff) | |
download | Shaarli-53ed6d7d1e678d7486337ce67a2f17b30bac21ac.tar.gz Shaarli-53ed6d7d1e678d7486337ce67a2f17b30bac21ac.tar.zst Shaarli-53ed6d7d1e678d7486337ce67a2f17b30bac21ac.zip |
Generate HTML documentation using MkDocs (WIP)
MkDocs is a static site generator geared towards building project documentation.
Documentation source files are written in Markdown, and configured with a single YAML file.
* http://www.mkdocs.org/
* http://www.mkdocs.org/user-guide/configuration/
Ref. #312
* remove pandoc-generated HTML documentation
* move markdown doc to doc/md/,
* mkdocs.yml:
* generate HTML doc in doc/html
* add pages TOC/ordering
* use index.md as index page
* Makefile: remove execute permissions from generated files
* Makefile: rewrite htmlpages GFM to markdown conversion using sed:
awk expression aslo matched '][' which causes invalid output on complex links with images or code blocks
* Add mkdocs.yml to .gitattributes, exclude this file from release archives
* Makefile: rename: htmldoc -> doc_html target
* run make doc: pull latest markdown documentation from wiki
* run make htmlpages: update html documentation
Diffstat (limited to 'doc/html/Unit-tests')
-rw-r--r-- | doc/html/Unit-tests/index.html | 492 |
1 files changed, 492 insertions, 0 deletions
diff --git a/doc/html/Unit-tests/index.html b/doc/html/Unit-tests/index.html new file mode 100644 index 00000000..84580db4 --- /dev/null +++ b/doc/html/Unit-tests/index.html | |||
@@ -0,0 +1,492 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> | ||
3 | <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> | ||
4 | <head> | ||
5 | <meta charset="utf-8"> | ||
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
7 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
8 | |||
9 | |||
10 | <link rel="shortcut icon" href="../img/favicon.ico"> | ||
11 | <title>Unit tests - Shaarli Documentation</title> | ||
12 | <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'> | ||
13 | |||
14 | <link rel="stylesheet" href="../css/theme.css" type="text/css" /> | ||
15 | <link rel="stylesheet" href="../css/theme_extra.css" type="text/css" /> | ||
16 | <link rel="stylesheet" href="../css/highlight.css"> | ||
17 | <link href="../github-markdown.css" rel="stylesheet"> | ||
18 | |||
19 | <script> | ||
20 | // Current page data | ||
21 | var mkdocs_page_name = "Unit tests"; | ||
22 | var mkdocs_page_input_path = "Unit-tests.md"; | ||
23 | var mkdocs_page_url = "/Unit-tests/"; | ||
24 | </script> | ||
25 | |||
26 | <script src="../js/jquery-2.1.1.min.js"></script> | ||
27 | <script src="../js/modernizr-2.8.3.min.js"></script> | ||
28 | <script type="text/javascript" src="../js/highlight.pack.js"></script> | ||
29 | |||
30 | </head> | ||
31 | |||
32 | <body class="wy-body-for-nav" role="document"> | ||
33 | |||
34 | <div class="wy-grid-for-nav"> | ||
35 | |||
36 | |||
37 | <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav"> | ||
38 | <div class="wy-side-nav-search"> | ||
39 | <a href=".." class="icon icon-home"> Shaarli Documentation</a> | ||
40 | <div role="search"> | ||
41 | <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get"> | ||
42 | <input type="text" name="q" placeholder="Search docs" /> | ||
43 | </form> | ||
44 | </div> | ||
45 | </div> | ||
46 | |||
47 | <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> | ||
48 | <ul class="current"> | ||
49 | |||
50 | |||
51 | <li class="toctree-l1"> | ||
52 | |||
53 | <a class="" href="..">Home</a> | ||
54 | </li> | ||
55 | |||
56 | <li class="toctree-l1"> | ||
57 | |||
58 | <span class="caption-text">Setup</span> | ||
59 | <ul class="subnav"> | ||
60 | <li class=""> | ||
61 | |||
62 | <a class="" href="../Download-and-Installation/">Download and Installation</a> | ||
63 | </li> | ||
64 | <li class=""> | ||
65 | |||
66 | <a class="" href="../Upgrade-and-migration/">Upgrade and migration</a> | ||
67 | </li> | ||
68 | <li class=""> | ||
69 | |||
70 | <a class="" href="../Server-requirements/">Server requirements</a> | ||
71 | </li> | ||
72 | <li class=""> | ||
73 | |||
74 | <a class="" href="../Server-configuration/">Server configuration</a> | ||
75 | </li> | ||
76 | <li class=""> | ||
77 | |||
78 | <a class="" href="../Server-security/">Server security</a> | ||
79 | </li> | ||
80 | <li class=""> | ||
81 | |||
82 | <a class="" href="../Shaarli-configuration/">Shaarli configuration</a> | ||
83 | </li> | ||
84 | <li class=""> | ||
85 | |||
86 | <a class="" href="../Plugins/">Plugins</a> | ||
87 | </li> | ||
88 | </ul> | ||
89 | </li> | ||
90 | |||
91 | <li class="toctree-l1"> | ||
92 | |||
93 | <span class="caption-text">Docker</span> | ||
94 | <ul class="subnav"> | ||
95 | <li class=""> | ||
96 | |||
97 | <a class="" href="../Docker-101/">Docker 101</a> | ||
98 | </li> | ||
99 | <li class=""> | ||
100 | |||
101 | <a class="" href="../Shaarli-images/">Shaarli images</a> | ||
102 | </li> | ||
103 | <li class=""> | ||
104 | |||
105 | <a class="" href="../Reverse-proxy-configuration/">Reverse proxy configuration</a> | ||
106 | </li> | ||
107 | <li class=""> | ||
108 | |||
109 | <a class="" href="../Docker-resources/">Docker resources</a> | ||
110 | </li> | ||
111 | </ul> | ||
112 | </li> | ||
113 | |||
114 | <li class="toctree-l1"> | ||
115 | |||
116 | <span class="caption-text">Usage</span> | ||
117 | <ul class="subnav"> | ||
118 | <li class=""> | ||
119 | |||
120 | <a class="" href="../Features/">Features</a> | ||
121 | </li> | ||
122 | <li class=""> | ||
123 | |||
124 | <a class="" href="../Bookmarklet/">Bookmarklet</a> | ||
125 | </li> | ||
126 | <li class=""> | ||
127 | |||
128 | <a class="" href="../Browsing-and-searching/">Browsing and searching</a> | ||
129 | </li> | ||
130 | <li class=""> | ||
131 | |||
132 | <a class="" href="../Firefox-share/">Firefox share</a> | ||
133 | </li> | ||
134 | <li class=""> | ||
135 | |||
136 | <a class="" href="../RSS-feeds/">RSS feeds</a> | ||
137 | </li> | ||
138 | <li class=""> | ||
139 | |||
140 | <a class="" href="../REST-API/">REST API</a> | ||
141 | </li> | ||
142 | </ul> | ||
143 | </li> | ||
144 | |||
145 | <li class="toctree-l1"> | ||
146 | |||
147 | <span class="caption-text">How To</span> | ||
148 | <ul class="subnav"> | ||
149 | <li class=""> | ||
150 | |||
151 | <a class="" href="../Backup,-restore,-import-and-export/">Backup, restore, import and export</a> | ||
152 | </li> | ||
153 | <li class=""> | ||
154 | |||
155 | <a class="" href="../Copy-an-existing-installation-over-SSH-and-serve-it-locally/">Copy an existing installation over SSH and serve it locally</a> | ||
156 | </li> | ||
157 | <li class=""> | ||
158 | |||
159 | <a class="" href="../Create-and-serve-multiple-Shaarlis-(farm)/">Create and serve multiple Shaarlis (farm)</a> | ||
160 | </li> | ||
161 | <li class=""> | ||
162 | |||
163 | <a class="" href="../Download-CSS-styles-from-an-OPML-list/">Download CSS styles from an OPML list</a> | ||
164 | </li> | ||
165 | <li class=""> | ||
166 | |||
167 | <a class="" href="../Datastore-hacks/">Datastore hacks</a> | ||
168 | </li> | ||
169 | </ul> | ||
170 | </li> | ||
171 | |||
172 | <li class="toctree-l1"> | ||
173 | |||
174 | <a class="" href="../Troubleshooting/">Troubleshooting</a> | ||
175 | </li> | ||
176 | |||
177 | <li class="toctree-l1"> | ||
178 | |||
179 | <span class="caption-text">Development</span> | ||
180 | <ul class="subnav"> | ||
181 | <li class=""> | ||
182 | |||
183 | <a class="" href="../Development-guidelines/">Development guidelines</a> | ||
184 | </li> | ||
185 | <li class=""> | ||
186 | |||
187 | <a class="" href="../Continuous-integration-tools/">Continuous integration tools</a> | ||
188 | </li> | ||
189 | <li class=""> | ||
190 | |||
191 | <a class="" href="../GnuPG-signature/">GnuPG signature</a> | ||
192 | </li> | ||
193 | <li class=""> | ||
194 | |||
195 | <a class="" href="../Coding-guidelines/">Coding guidelines</a> | ||
196 | </li> | ||
197 | <li class=""> | ||
198 | |||
199 | <a class="" href="../Directory-structure/">Directory structure</a> | ||
200 | </li> | ||
201 | <li class=""> | ||
202 | |||
203 | <a class="" href="../3rd-party-libraries/">3rd party libraries</a> | ||
204 | </li> | ||
205 | <li class=""> | ||
206 | |||
207 | <a class="" href="../Plugin-System/">Plugin System</a> | ||
208 | </li> | ||
209 | <li class=""> | ||
210 | |||
211 | <a class="" href="../Release-Shaarli/">Release Shaarli</a> | ||
212 | </li> | ||
213 | <li class=""> | ||
214 | |||
215 | <a class="" href="../Versioning-and-Branches/">Versioning and Branches</a> | ||
216 | </li> | ||
217 | <li class=""> | ||
218 | |||
219 | <a class="" href="../Security/">Security</a> | ||
220 | </li> | ||
221 | <li class=""> | ||
222 | |||
223 | <a class="" href="../Static-analysis/">Static analysis</a> | ||
224 | </li> | ||
225 | <li class=""> | ||
226 | |||
227 | <a class="" href="../Theming/">Theming</a> | ||
228 | </li> | ||
229 | <li class=" current"> | ||
230 | |||
231 | <a class="current" href="./">Unit tests</a> | ||
232 | <ul class="subnav"> | ||
233 | |||
234 | <li class="toctree-l3"><a href="#setup-your-environment-for-tests">Setup your environment for tests</a></li> | ||
235 | |||
236 | <ul> | ||
237 | |||
238 | <li><a class="toctree-l4" href="#sample-usage">Sample usage</a></li> | ||
239 | |||
240 | <li><a class="toctree-l4" href="#install-shaarli-dev-dependencies">Install Shaarli dev dependencies</a></li> | ||
241 | |||
242 | <li><a class="toctree-l4" href="#install-and-enable-xdebug-to-generate-phpunit-coverage-reports">Install and enable Xdebug to generate PHPUnit coverage reports</a></li> | ||
243 | |||
244 | <li><a class="toctree-l4" href="#run-unit-tests">Run unit tests</a></li> | ||
245 | |||
246 | <li><a class="toctree-l4" href="#test-results-and-coverage">Test results and coverage</a></li> | ||
247 | |||
248 | </ul> | ||
249 | |||
250 | |||
251 | <li class="toctree-l3"><a href="#executing-specific-tests">Executing specific tests</a></li> | ||
252 | |||
253 | |||
254 | </ul> | ||
255 | </li> | ||
256 | </ul> | ||
257 | </li> | ||
258 | |||
259 | <li class="toctree-l1"> | ||
260 | |||
261 | <span class="caption-text">About</span> | ||
262 | <ul class="subnav"> | ||
263 | <li class=""> | ||
264 | |||
265 | <a class="" href="../FAQ/">FAQ</a> | ||
266 | </li> | ||
267 | <li class=""> | ||
268 | |||
269 | <a class="" href="../Community-&-Related-software/">Community & Related software</a> | ||
270 | </li> | ||
271 | </ul> | ||
272 | </li> | ||
273 | |||
274 | </ul> | ||
275 | </div> | ||
276 | | ||
277 | </nav> | ||
278 | |||
279 | <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> | ||
280 | |||
281 | |||
282 | <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> | ||
283 | <i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
284 | <a href="..">Shaarli Documentation</a> | ||
285 | </nav> | ||
286 | |||
287 | |||
288 | <div class="wy-nav-content"> | ||
289 | <div class="rst-content"> | ||
290 | <div role="navigation" aria-label="breadcrumbs navigation"> | ||
291 | <ul class="wy-breadcrumbs"> | ||
292 | <li><a href="..">Docs</a> »</li> | ||
293 | |||
294 | |||
295 | |||
296 | <li>Development »</li> | ||
297 | |||
298 | |||
299 | |||
300 | <li>Unit tests</li> | ||
301 | <li class="wy-breadcrumbs-aside"> | ||
302 | |||
303 | <a href="https://github.com/shaarli/Shaarli/edit/master/docs/Unit-tests.md" | ||
304 | class="icon icon-github"> Edit on GitHub</a> | ||
305 | |||
306 | </li> | ||
307 | </ul> | ||
308 | <hr/> | ||
309 | </div> | ||
310 | <div role="main"> | ||
311 | <div class="section"> | ||
312 | |||
313 | <h3 id="setup-your-environment-for-tests">Setup your environment for tests</h3> | ||
314 | <p>The framework used is <a href="https://phpunit.de/">PHPUnit</a>; it can be installed with <a href="https://getcomposer.org/">Composer</a>, which is a dependency management tool.</p> | ||
315 | <p>Regarding Composer, you can either use: | ||
316 | <em> a system-wide version, e.g. installed through your distro's package manager | ||
317 | </em> a local version, downloadable <a href="https://getcomposer.org/download/">here</a></p> | ||
318 | <h4 id="sample-usage">Sample usage</h4> | ||
319 | <pre><code class="bash"># system-wide version | ||
320 | $ composer install | ||
321 | $ composer update | ||
322 | |||
323 | # local version | ||
324 | $ php composer.phar self-update | ||
325 | $ php composer.phar install | ||
326 | $ php composer.phar update | ||
327 | </code></pre> | ||
328 | |||
329 | <h4 id="install-shaarli-dev-dependencies">Install Shaarli dev dependencies</h4> | ||
330 | <pre><code class="bash">$ cd /path/to/shaarli | ||
331 | $ composer update | ||
332 | </code></pre> | ||
333 | |||
334 | <h4 id="install-and-enable-xdebug-to-generate-phpunit-coverage-reports">Install and enable Xdebug to generate PHPUnit coverage reports</h4> | ||
335 | <p>For Debian-based distros:</p> | ||
336 | <pre><code class="bash">$ aptitude install php5-xdebug | ||
337 | </code></pre> | ||
338 | |||
339 | <p>For ArchLinux:</p> | ||
340 | <pre><code class="bash">$ pacman -S xdebug | ||
341 | </code></pre> | ||
342 | |||
343 | <p>Then add the following line to <code>/etc/php/php.ini</code>:</p> | ||
344 | <pre><code class="ini">zend_extension=xdebug.so | ||
345 | </code></pre> | ||
346 | |||
347 | <h4 id="run-unit-tests">Run unit tests</h4> | ||
348 | <p>Successful test suite:</p> | ||
349 | <pre><code class="bash">$ make test | ||
350 | |||
351 | ------- | ||
352 | PHPUNIT | ||
353 | ------- | ||
354 | PHPUnit 4.6.9 by Sebastian Bergmann and contributors. | ||
355 | |||
356 | Configuration read from /home/virtualtam/public_html/shaarli/phpunit.xml | ||
357 | |||
358 | .................................... | ||
359 | |||
360 | Time: 759 ms, Memory: 8.25Mb | ||
361 | |||
362 | OK (36 tests, 65 assertions) | ||
363 | </code></pre> | ||
364 | |||
365 | <p>Test suite with failures and errors:</p> | ||
366 | <pre><code class="bash">$ make test | ||
367 | ------- | ||
368 | PHPUNIT | ||
369 | ------- | ||
370 | PHPUnit 4.6.9 by Sebastian Bergmann and contributors. | ||
371 | |||
372 | Configuration read from /home/virtualtam/public_html/shaarli/phpunit.xml | ||
373 | |||
374 | E..FF............................... | ||
375 | |||
376 | Time: 802 ms, Memory: 8.25Mb | ||
377 | |||
378 | There was 1 error: | ||
379 | |||
380 | 1) LinkDBTest::testConstructLoggedIn | ||
381 | Missing argument 2 for LinkDB::__construct(), called in /home/virtualtam/public_html/shaarli/tests/Link\ | ||
382 | DBTest.php on line 79 and defined | ||
383 | |||
384 | /home/virtualtam/public_html/shaarli/application/LinkDB.php:58 | ||
385 | /home/virtualtam/public_html/shaarli/tests/LinkDBTest.php:79 | ||
386 | |||
387 | -- | ||
388 | |||
389 | There were 2 failures: | ||
390 | |||
391 | 1) LinkDBTest::testCheckDBNew | ||
392 | Failed asserting that two strings are equal. | ||
393 | --- Expected | ||
394 | +++ Actual | ||
395 | @@ @@ | ||
396 | -'e3edea8ea7bb50be4bcb404df53fbb4546a7156e' | ||
397 | +'85eab0c610d4f68025f6ed6e6b6b5fabd4b55834' | ||
398 | |||
399 | /home/virtualtam/public_html/shaarli/tests/LinkDBTest.php:121 | ||
400 | |||
401 | 2) LinkDBTest::testCheckDBLoad | ||
402 | Failed asserting that two strings are equal. | ||
403 | --- Expected | ||
404 | +++ Actual | ||
405 | @@ @@ | ||
406 | -'e3edea8ea7bb50be4bcb404df53fbb4546a7156e' | ||
407 | +'85eab0c610d4f68025f6ed6e6b6b5fabd4b55834' | ||
408 | |||
409 | /home/virtualtam/public_html/shaarli/tests/LinkDBTest.php:133 | ||
410 | |||
411 | FAILURES! | ||
412 | Tests: 36, Assertions: 63, Errors: 1, Failures: 2. | ||
413 | </code></pre> | ||
414 | |||
415 | <h4 id="test-results-and-coverage">Test results and coverage</h4> | ||
416 | <p>By default, PHPUnit will run all suitable tests found under the <code>tests</code> directory.</p> | ||
417 | <p>Each test has 3 possible outcomes: | ||
418 | <em> <code>.</code> - success | ||
419 | </em> <code>F</code> - failure: the test was run but its results are invalid | ||
420 | * the code does not behave as expected | ||
421 | * dependencies to external elements: globals, session, cache... | ||
422 | * <code>E</code> - error: something went wrong and the tested code has crashed | ||
423 | * typos in the code, or in the test code | ||
424 | * dependencies to missing external elements</p> | ||
425 | <p>If Xdebug has been installed and activated, two coverage reports will be generated: | ||
426 | <em> a summary in the console | ||
427 | </em> a detailed HTML report with metrics for tested code | ||
428 | * to open it in a web browser: <code>firefox coverage/index.html &</code></p> | ||
429 | <h3 id="executing-specific-tests">Executing specific tests</h3> | ||
430 | <p>Add a <a href="https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.group"><code>@group</code></a> annotation in a test class or method comment:</p> | ||
431 | <pre><code class="php">/** | ||
432 | * Netscape bookmark import | ||
433 | * @group WIP | ||
434 | */ | ||
435 | class BookmarkImportTest extends PHPUnit_Framework_TestCase | ||
436 | { | ||
437 | [...] | ||
438 | } | ||
439 | </code></pre> | ||
440 | |||
441 | <p>To run all tests annotated with <code>@group WIP</code>:</p> | ||
442 | <pre><code class="bash">$ vendor/bin/phpunit --group WIP tests/ | ||
443 | </code></pre> | ||
444 | |||
445 | </div> | ||
446 | </div> | ||
447 | <footer> | ||
448 | |||
449 | <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> | ||
450 | |||
451 | <a href="../FAQ/" class="btn btn-neutral float-right" title="FAQ">Next <span class="icon icon-circle-arrow-right"></span></a> | ||
452 | |||
453 | |||
454 | <a href="../Theming/" class="btn btn-neutral" title="Theming"><span class="icon icon-circle-arrow-left"></span> Previous</a> | ||
455 | |||
456 | </div> | ||
457 | |||
458 | |||
459 | <hr/> | ||
460 | |||
461 | <div role="contentinfo"> | ||
462 | <!-- Copyright etc --> | ||
463 | |||
464 | </div> | ||
465 | |||
466 | Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
467 | </footer> | ||
468 | |||
469 | </div> | ||
470 | </div> | ||
471 | |||
472 | </section> | ||
473 | |||
474 | </div> | ||
475 | |||
476 | <div class="rst-versions" role="note" style="cursor: pointer"> | ||
477 | <span class="rst-current-version" data-toggle="rst-current-version"> | ||
478 | |||
479 | <a href="https://github.com/shaarli/Shaarli" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a> | ||
480 | |||
481 | |||
482 | <span><a href="../Theming/" style="color: #fcfcfc;">« Previous</a></span> | ||
483 | |||
484 | |||
485 | <span style="margin-left: 15px"><a href="../FAQ/" style="color: #fcfcfc">Next »</a></span> | ||
486 | |||
487 | </span> | ||
488 | </div> | ||
489 | <script src="../js/theme.js"></script> | ||
490 | |||
491 | </body> | ||
492 | </html> | ||