4.7.3.1 About fixtures
When testing code that depends on models and data, one can use fixtures as a way to generate temporary data tables loaded with sample data that can be used by the test. The benefit of using fixtures is that your test has no chance of disrupting live application data. In addition, you can begin testing your code prior to actually developing live content for an application.
CakePHP attempts to use the connection named $test in your app/config/database.php configuration file. If this connection is not usable, it will use the $default database configuration and create the test tables in the database defined in that configuration. In either case, it will add "test_suite_" to your own table prefix (if any) to prevent collision with your existing tables.
CakePHP performs the following during the course of a fixture based test case:
- Creates tables for each of the fixtures needed
- Populates tables with data, if data is provided in fixture
- Runs test methods
- Empties the fixture tables
- Removes fixture tables from database
