Example: PHPUnit

Same name in other branches
  1. 3.x modules/phpunit_example/phpunit_example.module \phpunit_example

This example demonstrates PHPUnit for Drupal 8 unit testing.

Parent topics

File

modules/phpunit_example/phpunit_example.module, line 8

Classes

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

Interfaces

Title Sort descending File name Summary
DisplayInfoInterface modules/phpunit_example/src/DisplayInfoInterface.php An interface to objects that provide displayable information.