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 string
Build 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()
init( )
Initialize the fixture.
Cake\ORM\Exception\MissingTableClassException
insert( Cake\Datasource\ConnectionInterface $db )
Run before each test is executed.
Cake\Datasource\ConnectionInterface
$db
Cake\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()
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()
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.
null
© 2005–2017 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.4/class-Cake.TestSuite.Fixture.TestFixture.html