DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

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.php containing a class with functions that have the @test annotation.
  • If you need to store data for fixtures, create a sub directory Tests/Fixtures/ or Tests/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 of Tests/ (with a capital first letter)
  • using _testcase.php as suffix for test case files (instead of the *Test.php suffix)
  • using test_* as prefix for test functions (instead of the @test annotation)