vierge-noire/cakephp-test-suite-light
Speed up CakePHP test suites with Test Suite Light. It wraps tests in database transactions and reduces fixture overhead, cutting setup and cleanup time so integration tests run faster while keeping the familiar CakePHP testing workflow.
composer require --dev vierge-noire/cakephp-test-suite-light
phpunit.xml and Datasources in config/app.php. There is no plugin to bin/cake plugin load — this is a dev-only test bootstrap.tests/bootstrap.php: require Composer's autoloader, then the package's bootstrap.php (see the package src/ / README for the exact path, e.g. vendor/vierge-noire/cakephp-test-suite-light/bootstrap.php). That require is what installs the fixture/transaction hooks and triggers creation of the <connection>_test database on first run.phpunit.xml uses bootstrap="tests/bootstrap.php" and that the default Datasources entry has a test counterpart (standard CakePHP <dbname>_test convention)._test database manually. The first run is where most setup pain lives.$fixtures, run vendor/bin/phpunit tests/TestCase/Controller/ArticlesControllerTest.php, and time it. Then run a control test extending plain Cake\TestSuite\TestCase to confirm the speedup. You should see schema loaded once, fixtures loaded once, and each test wrapped in a transaction that is rolled back.tests/bootstrap.php, phpunit.xml, config/app.php Datasources, then the package's src/ (bootstrap.php, connection helper, test listener) — the README is short and the source is the real documentation.tests/TestCase.php. Let it extend the normal CakePHP test case and let the package hooks do the work; do not override setUp/tearDown in a way that commits or truncates.$fixtures as usual. The plugin changes when/how often they load (once at suite start) and relies on rollback for per-test isolation, so fixture declarations still matter for data availability.cakephp-fixture-factories, Faker) or Table::newEntity() + saveOrFail() in setUp() are cheap because the insert is rolled back. Prefer this over ever-growing static fixtures.Datasources entry used in tests needs a test variant; the package tracks transactions per connection/savepoint.vendor/ but never cache the _test database. Add a DROP DATABASE IF EXISTS <name>_test step before the suite if a previous job can leave it dirty, then let the bootstrap recreate it.--filter testWhatever --debug. Pass alone + fail in suite almost always means leaked state from a committed transaction.Cake\TestSuite\TestCase (or a small NoTransactionTrait marker) so the transaction wrapper doesn't interfere._test database name. Multiple workers sharing one database defeats the isolation model.Cake\TestSuite\Fixture\TransactionStrategy. If that is enough for you, the plugin's remaining value is mostly one-time schema/fixture loading and convenience bootstrap; evaluate before adding a dependency._test database after migration changes, and treat it as disposable.commit(), DDL (CREATE/ALTER/DROP), or transaction opened outside the package's savepoints breaks rollback and leaks data into later tests. Audit fixture/factory code and application code that manages transactions.truncate() or deleteAll() in fixtures or teardown. It defeats the purpose, and TRUNCATE implicitly commits on MySQL, which can corrupt the strategy's state.composer.json before upgrading PHPUnit or CakePHP. Last release being Oct 2023 with ~13 stars means low maintenance — pin versions and be ready to fork._test database isn't created, confirm credentials and that the app's default connection is reachable; run one test with -v to surface the bootstrap exception.src/: the connection helper (how the _test name is derived and created), any Configure::write('TestSuiteLight', [...])-style options for enabling/cleanup behavior, and the listener — those are where you customize database naming or disable behavior per environment.--dev, and the bootstrap assumes a disposable test database. Keep it out of production autoload paths and CI secrets that point at real data.How can I help you explore Laravel packages today?