TestHelper plugin for CakePHP
Browser based Addons for your test driven development.
Note: This branch is for CakePHP 3.6+. See version map for details.
After 2.x=>3.x, the "web-tester" has been removed. It was, for certain cases, however, quite useful. This aims to bring back a part of it.
The CLI also doesn't allow a good overview. Even with auto-complete, you have to type almost everything out. With a browser backend generating tests or running them is just a simple mouse click.
You have an overview of your classes and the test classes to it. If there is one missing, you can easily "bake" it from this web backend. It internally uses Bake plugin as well as your preferred theme.
- URL array generation from string URLs (respects routing, so it is basically also a reverse lookup)
- Fixture validation tool (compares actual DB with the schema files: fields and attributes, constraints and indexes)
You can install this plugin into your CakePHP application using composer:
composer require --dev dereuromark/cakephp-test-helper
Note: This is not meant for production, so make sure you use the
--dev flag and install it as development-only tool.
Don't forget to load it under your bootstrap function in
This will also load the routes.
In older applications you used the bootstrap file:
Plugin::load('TestHelper', ['routes' => true]);
/test-helper backend and select the app or plugin you want to check.
You can then with a single click
- check what classes do not yet have a test case
- generate a test case for them (or copy and paste a generated code into CLI)
- run test case
- check coverage on a tested class, as overall and in detail
Supported class types:
- Models (Tables/Entities)
Feel free to help out improving and completing this test helper plugin.
Executing the tests and coverage from the web backend usually can not work for long running tests due to the timeout issues. Make sure you raise the apache/nginx settings here if you want to use this functionality here.
The focus is on providing an overview and quickly generating the desired classes with a single mouse click.