Base interface for strategies used to manage fixtures for TestCase.
Fixture strategy that deletes all rows from the fixture tables at the end of test.
A drop-in alternative to {@link \Cake\TestSuite\Fixture\TruncateStrategy}: fixtures are
inserted before each test and the tables are emptied afterwards, without a wrapping
transaction, so afterCommit listeners behave as they do in the application.
TRUNCATE is a DDL statement, and on most database servers it does more work than
removing the rows - InnoDB for example drops and recreates the tablespace of every
table it is issued against. Deleting the handful of rows a fixture holds is usually
a lot cheaper, so test suites with many fixtures can spend noticeably less time in
teardown with this strategy.
The trade off is that DELETE does not reset auto increment counters. Fixtures
whose records omit their primary key, and which other fixtures or assertions then
refer to by id, need that counter to start from 1 in every test and have to keep
using TruncateStrategy.
Unlike TRUNCATE, DELETE is subject to foreign keys on every driver, so the rows
are removed with the constraints disabled and the order of the fixtures does not
matter.
Helper for managing fixtures.
Create test database schema from one or more SQL dump files.
This class can be useful to create test database schema when your schema is managed by tools external to your CakePHP application.
It is not well suited for applications/plugins that need to support multiple database platforms. You should use migrations for that instead.
Cake TestFixture is responsible for building and destroying tables to be used during testing.
Fixture strategy that wraps fixtures in a transaction that is rolled back after each test.
Any test that calls Connection::rollback(true) will break this strategy.
Fixture strategy that truncates all fixture tables at the end of test.