You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/sourcecode.rst
+15-48Lines changed: 15 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,31 +262,10 @@ Unit testing (and functional testing)
262
262
263
263
A note for the purists... In GLPI, there are both unit and functional tests; without real distinction ;-)
264
264
265
-
We use `PHPUnit <https://phpunit.de>`_ for tests.
266
-
`atoum`'s documentation in available at: http://docs.atoum.org
265
+
We use `PHPUnit <https://phpunit.de>`_ for PHP tests.
267
266
268
267
For JavaScript tests, GLPI uses the Jest testing framework.
269
-
It's documentation can be found at: https://devdocs.io/jest/.
270
-
271
-
.. warning::
272
-
273
-
With `atoum`, test class **must** refer to an existing class of the project!
274
-
This means that your test class must have the same name and relative namespace as an existing class.]
275
-
276
-
Tests isolation
277
-
^^^^^^^^^^^^^^^
278
-
279
-
PHP tests must be run in an isolated environment. By default, `atoum` use a concurrent mode; that launches tests in a multi-threaded environment. While it is possible to bypass this; this should not be done See http://docs.atoum.org/en/latest/engine.html.
280
-
281
-
For technical reasons (mainly because of the huge session usage), GLPI PHP unit tests are actually limited to one only thread while running the whole suite; but while developing, the behavior should only be changed if this is really needed.
282
-
283
-
For JavaScript tests, Jest is able to run multiple tests in parallel as long as they are in different *spec* files since they don't interact with database data or a server.
284
-
This behavior is the default.
285
-
286
-
Type hitting
287
-
^^^^^^^^^^^^
288
-
289
-
Unlike PHPUnit, `atoum` is very strict on type hitting. This really makes sense; but often in GLPI types are not what we should expect (for example, we often get a string and not an integer from counting methods).
268
+
Its documentation can be found at: https://devdocs.io/jest/.
290
269
291
270
Database
292
271
^^^^^^^^
@@ -323,44 +302,32 @@ When you use a property that has not been declared, you will have errors that ma
If you want to run the web tests suite, you need to run a web server, and give tests its URL when running. Here is an example using PHP native webserver:
345
326
346
327
.. code-block:: bash
347
328
348
-
php-Slocalhost:8088tests/router.php&>/dev/null &
349
-
350
-
351
-
Running `atoum` without any arguments will show you the possible options. Most important are:
352
-
353
-
* ``-bf`` to set bootstrap file,
354
-
* ``-d`` to run tests located in a whole directory,
355
-
* ``-f`` to run tests on a standalone file,
356
-
* ``-m`` to run tests on a specific method (-f must also be defined),
357
-
* ``--debug`` to get extra informations when something goes wrong,
358
-
* ``-mcn`` limit number of concurrent runs. This is unfortunately mandatory running the whole test suite right now :/,
359
-
* ``-ncc`` do not generate code coverage,
360
-
* ``--php`` to change PHP executable to use,
361
-
* ``-l`` loop mode.
362
-
363
-
Note that if you do not use the `-ncc` switch; coverage will be generated in the `tests/code-coverage/` directory.
0 commit comments