{# Description text for the PHPUnit Example. #} {% set sum_in_hands = path('testing_example.sum_in_hands') %} {% trans %}
This module provides a path so we can test it. The path takes two numeric arguments, and tells you how many hands are required to count the sum of both numbers.
You really should be reading the various documentation comments in the files under
tests/src/
.
tests/src
directory, so
they will not be loaded by the autoloader during normal bootstrap.
[your_module]/tests/src/Unit
.[your_module]/tests/src/Kernel
.[your_module]/tests/src/Functional
.Type | Location | Namespace | Subclass of |
Unit test | [your_module]/tests/src/Unit | Drupal\Tests\[your_module]\Unit\ | Drupal\Tests\UnitTestCase |
Kernel test | [your_module]/tests/src/Kernel | Drupal\Tests\[your_module]\Kernel\ | Drupal\KernelTests\KernelTestBase |
Functional test | [your_module]/tests/src/Functional | Drupal\Tests\[your_module]\Functional\ | Drupal\Tests\BrowserTestBase |
FunctionalJavascript test | [your_module]/tests/src/FunctionalJavascript | Drupal\Tests\[your_module]\FunctionalJavascript\ | Drupal\FunctionalJavascriptTests\WebDriverTestBase |
Shared test traits | [your_module]/tests/src/Traits | Drupal\Tests\[your_module]\Traits\ | n/a |
You can run PHPUnit from the command line or via the run-tests.sh command.
You can specify which type of test you're running via
phpunit --testsuite
and
run-tests.sh --types
.There are many options to phpunit, but, for instance, to run all of the testing_example phpunit tests, you could
{% endtrans %}./vendor/phpunit/phpunit/phpunit -c core/ ./modules/examples/testing_example