Creating unit tests for your extension¶
In order to create a unit test, you need to create a directory
Tests/Unit/in your extension directory and add some PHP files ending with*Test.phpcontaining a class with functions that have the@testannotation.If you need to store data for fixtures, create a sub directory
Tests/Fixtures/orTests/Unit/Fixtures/.Consult the PHPUnit documentation for information on writing tests, available functions etc.
Things that work, but that are deprecated¶
tests/(lowercase) as the name for the tests directory (instead ofTests/(with a capital first letter)using
_testcase.phpas suffix for test case files (instead of the*Test.phpsuffix)using
test_*as prefix for test functions (instead of the@testannotation)