Skip to content

Configuration ​

All keys live under the TestHelper config prefix. See config/app.example.php for the canonical, copy-paste reference.

Authorization ​

If you use the CakePHP Authorization plugin, TestHelper skips its checks automatically while debug is enabled. To deliberately skip them outside debug, use:

php
Configure::write('TestHelper.ignoreAuthorization', true);

Show a "back" link in the TestHelper navbar that returns to your app's admin area:

php
// config/app.php
'TestHelper' => [
    // Anything Router::url() accepts; 'plugin' => false anchors it to the host app.
    'adminBackUrl' => ['plugin' => false, 'prefix' => 'Admin', 'controller' => 'Overview', 'action' => 'index'],
    'adminBackLabel' => 'Back to admin', // Optional. Defaults to "Back to App".
],

Leave adminBackUrl unset to hide the link (the default).

Test runner ​

php
'TestHelper' => [
    // Custom phpunit command. Both `php phpunit.phar` and `vendor/bin/phpunit` work out of the box.
    'command' => null,
    // Custom PHP binary path, e.g. '/usr/bin/php8.2'.
    'php' => null,
],

PHPUnit selects the available coverage driver in the CLI process. TestHelper enables Xdebug coverage mode for that process; PCOV must be installed and enabled in CLI PHP. The legacy coverage key does not select or install a driver.

Your own templates ​

The default templates ship with Bootstrap 5 and Font Awesome icons. You can swap any view template for your own at the project level, as documented in the CakePHP docs.

Tool-specific configuration ​

Some tools have their own keys, documented on their pages:

TestHelper.php accepts one executable path. It is quoted as a single command argument, so values such as php -d memory_limit=-1 must use a wrapper executable instead. For the test runner, TestHelper.command can contain the full PHPUnit command, including PHP options. Test and fixture generation always uses the executable path.

Released under the MIT License.