{# Description text for the PHPUnit Example. #} {% trans %}

PHPUnit for Drupal: A very basic how-to.

How to use this example module

You really should be reading the various documentation comments in the test files.

How To:

Standard PHPUnit Practices

You can (and really, should) run PHPUnit from the command line.

On Unix-based systems, this means you need to cd core and then

./vendor/bin/phpunit

On Windows-based systems, assuming you have php in your path,

php ./vendor/phpunit/phpunit/composer/bin/phpunit --group phpunit_example

Also, you should mark your tests as belonging to a group, so they can be run independently. You do this by annotating your test classes with @group group_name. You should have a @group for your module name, and you should also have a @group for integrations, such as views.

So, for instance, to run all the PHPUnit example tests, you would type

./vendor/bin/phpunit --group phpunit_example

As you can see, including a @group annotation is a good idea.

{% endtrans %}