This example demonstrates PHPUnit for Drupal 8 unit testing.

Parent topics

File

phpunit_example/phpunit_example.module, line 8
Module file for phpunit_example.

Classes

Namesort descending Location Description
AddClass phpunit_example/src/AddClass.php A class with features to show how to do unit testing.
AddClassTest phpunit_example/tests/src/Unit/AddClassTest.php AddClass units tests.
DisplayManager phpunit_example/src/DisplayManager.php An example class to demonstrate unit testing.
DisplayManagerTest phpunit_example/tests/src/Unit/DisplayManagerTest.php DisplayManager unit test with doubles.
PHPUnitExampleMenuTest phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php Test the user-facing menus in PHPUnit Example.
ProtectedPrivates phpunit_example/src/ProtectedPrivates.php A class with features to show how to do unit testing.
ProtectedPrivatesSubclass phpunit_example/tests/src/Unit/Subclasses/ProtectedPrivatesSubclass.php A class for testing ProtectedPrivate::protectedAdd().
ProtectedPrivatesTest phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php ProtectedPrivates unit testing of restricted methods.

Interfaces

Namesort descending Location Description
DisplayInfoInterface phpunit_example/src/DisplayInfoInterface.php An interface to objects that provide displayable information.