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/codingstandards.rst
+5-29Lines changed: 5 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,33 +245,9 @@ Examples:
245
245
Checking standards
246
246
------------------
247
247
248
-
In order to check standards are respected, we provide a defaut configuration for `PHP CodeSniffer <http://pear.php.net/package/PHP_CodeSniffer>`_ rules. From the GLPI directory, just run:
248
+
Linting (checking and fixing coding standards) is a good way to ensure code quality and consistency of the code base.
249
+
This is done using [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer), [PHPStan](https://phpstan.org/), [ESLint](https://eslint.org/), [Stylelint](https://stylelint.io/) and [TwigCS](https://github.com/friendsoftwig/twigcs).
249
250
250
-
.. code-block::
251
-
252
-
phpcs .
253
-
254
-
If the above command does not provide any output, then, all is OK :)
40 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found
267
-
|| 3
268
-
59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found
269
-
|| 3
270
-
64 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found
271
-
|| 3
272
-
273
-
To automatically fix most of the issues, use `phpcbf`, it will per default rely on default configuration:
274
-
275
-
.. code-block::
276
-
277
-
phpcbf .
251
+
This can run the tasks using Docker, on your local host use `./tests/run_tests.sh lint` to proceed to all linting tasks, or use a scoped task, `./tests/run_tests.sh lint_php` to proceed to PHP linting only for example.
252
+
All possible lintings are listed in the `./tests/run_tests.sh` script.
253
+
For faster action you can run the scripts on your local machine or Docker development container using `node_modules/.bin/eslint . && echo "ESLint found no errors"` for example. You can find all the commands in [`.github/actions` directory](https://github.com/glpi-project/glpi/tree/main/.github/actions).
Copy file name to clipboardExpand all lines: source/sourcecode.rst
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,9 @@ Those branches are created when a new major or intermediate version is released.
37
37
Testing
38
38
-------
39
39
40
-
There are more and more unit tests in GLPI; we use the `atoum unit tests framework <http://atoum.org>`_.
40
+
Testing is a very important part of the development process.
41
+
The reference for tests is the `GitHub CI <https://github.com/glpi-project/glpi/blob/main/.github/workflows/ci.yml>`_.
42
+
The easier way to proceed with testing is to use the provided test script `run_tests.sh <https://github.com/glpi-project/glpi/blob/main/tests/run_tests.sh>`_ which uses Docker and bootstrap everything needed.
41
43
42
44
Every proposal **must** contains unit tests; for new features as well as bugfixes. For the bugfixes; this is not a strict requirement if this is part of code that is not tested at all yet. See the :ref:`unit testing section <unittests>` at the bottom of the page.
43
45
@@ -260,7 +262,7 @@ Unit testing (and functional testing)
260
262
261
263
A note for the purists... In GLPI, there are both unit and functional tests; without real distinction ;-)
262
264
263
-
We use the `atoum unit tests framework <http://atoum.org>`_ for PHP tests; see `GLPI website if you wonder why <http://glpi-project.org/spip.php?breve375>`_.
265
+
We use `PHPUnit <https://phpunit.de>`_ for tests.
264
266
`atoum`'s documentation in available at: http://docs.atoum.org
265
267
266
268
For JavaScript tests, GLPI uses the Jest testing framework.
0 commit comments