Cake TestFixture is responsible for building and destroying tables to be used during testing.
$_constraints protected array$_schema protected $connection public string$fields public array$import public array|null$records public array$table public stringBuild and execute SQL queries necessary to create the constraints for the fixture
Build and execute SQL queries necessary to drop the constraints for the fixture
__construct( )
Instantiate the fixture.
Cake\Core\Exception\Exception_getRecords( )
Converts the internal records into data used to generate a query.
_schemaFromFields( )
Build the fixtures table schema from the fields property.
_schemaFromImport( )
Build fixture schema from a table in another datasource.
Cake\Core\Exception\Exception_schemaFromReflection( )
Build fixture schema directly from the datasource
Cake\Core\Exception\Exception_tableFromClass( )
Returns the table name using the fixture class
connection( )
Get the connection name this fixture should be inserted into.
Cake\Datasource\FixtureInterface::connection() create( Cake\Datasource\ConnectionInterface $db )
Create the fixture schema/mapping/definition
Cake\Datasource\ConnectionInterface $db Cake\Datasource\FixtureInterface::create() createConstraints( Cake\Datasource\ConnectionInterface $db )
Build and execute SQL queries necessary to create the constraints for the fixture
Cake\Datasource\ConnectionInterface $db Cake\Datasource\FixtureInterface::createConstraints() drop( Cake\Datasource\ConnectionInterface $db )
Run after all tests executed, should remove the table/collection from the connection.
Cake\Datasource\ConnectionInterface $db Cake\Datasource\FixtureInterface::drop() dropConstraints( Cake\Datasource\ConnectionInterface $db )
Build and execute SQL queries necessary to drop the constraints for the fixture
Cake\Datasource\ConnectionInterface $db Cake\Datasource\FixtureInterface::dropConstraints() getTableSchema( )
Get and set the schema for this fixture.
Cake\Database\Schema\TableSchemaInterface|nullCake\Database\Schema\TableSchemaAwareInterface::getTableSchema() init( )
Initialize the fixture.
Cake\ORM\Exception\MissingTableClassExceptioninsert( Cake\Datasource\ConnectionInterface $db )
Run before each test is executed.
Cake\Datasource\ConnectionInterface $db Cake\Database\StatementInterface|booleanCake\Datasource\FixtureInterface::insert() schema( Cake\Database\Schema\TableSchema $schema = null )
Gets/Sets the TableSchema instance used by this fixture.
Cake\Database\Schema\TableSchema $schema optional null Cake\Database\Schema\TableSchema|nullCake\Datasource\TableSchemaInterface::schema() setTableSchema( Cake\Database\Schema\TableSchemaInterface $schema )
Get and set the schema for this fixture.
Cake\Database\Schema\TableSchemaInterface $schema Cake\Database\Schema\TableSchemaAwareInterface::setTableSchema() sourceName( )
Get the table/collection name for this fixture.
Cake\Datasource\FixtureInterface::sourceName() truncate( Cake\Datasource\ConnectionInterface $db )
Truncates the current fixture.
Cake\Datasource\ConnectionInterface $db Cake\Datasource\FixtureInterface::truncate() getTableLocator( )
Gets the table locator.
Cake\ORM\Locator\LocatorInterfacesetTableLocator( Cake\ORM\Locator\LocatorInterface $tableLocator )
Sets the table locator.
Cake\ORM\Locator\LocatorInterface $tableLocator tableLocator( Cake\ORM\Locator\LocatorInterface $tableLocator = null )
Sets the table locator. If no parameters are passed, it will return the currently used locator.
Cake\ORM\Locator\LocatorInterface $tableLocator optional null Cake\ORM\Locator\LocatorInterfacegetTableSchema() |
public array
Fields / Schema for the fixture.
This array should be compatible with Cake\Database\Schema\Schema. The _constraints, _options and _indexes keys are reserved for defining constraints, options and indexes respectively.
[]
public array|null
Configuration for importing fixture schema
Accepts a connection and model or table key, to define which table and which connection contain the schema to be imported.
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.TestSuite.Fixture.TestFixture.html