Cake TestFixture is responsible for building and destroying tables to be used during testing.
array<string, mixed>Fixture constraints to be created.
Cake\Database\Schema\TableSchemaInterfaceCake\Database\Schema\SqlGeneratorInterfaceThe schema for this fixture.
Cake\ORM\Locator\LocatorInterface|nullTable locator instance
stringFixture Datasource
string|nullThis object's default table alias.
arrayFields / Schema for the fixture.
array|nullConfiguration for importing fixture schema
arrayFixture records to be inserted.
stringFull Table Name
Instantiate the fixture.
Converts the internal records into data used to generate a query.
Build the fixtures table schema from the fields property.
Build fixture schema from a table in another datasource.
Build fixture schema directly from the datasource
Returns the table name using the fixture class
Get the connection name this fixture should be inserted into.
Create the fixture schema/mapping/definition
Build and execute SQL queries necessary to create the constraints for the fixture
Run after all tests executed, should remove the table/collection from the connection.
Build and execute SQL queries necessary to drop the constraints for the fixture
Convenience method to get a table instance.
Gets the table locator.
Get and set the schema for this fixture.
Initialize the fixture.
Run before each test is executed.
Sets the table locator.
Get and set the schema for this fixture.
Get the table/collection name for this fixture.
Truncates the current fixture.
__construct()
Instantiate the fixture.
Cake\Core\Exception\CakeException_getRecords(): array
Converts the internal records into data used to generate a query.
array_schemaFromFields(): void
Build the fixtures table schema from the fields property.
void_schemaFromImport(): void
Build fixture schema from a table in another datasource.
voidCake\Core\Exception\CakeException_schemaFromReflection(): void
Build fixture schema directly from the datasource
voidCake\Core\Exception\CakeException_tableFromClass(): string
Returns the table name using the fixture class
stringconnection(): string
Get the connection name this fixture should be inserted into.
stringcreate(Cake\Datasource\ConnectionInterface $connection): bool
Create the fixture schema/mapping/definition
Cake\Datasource\ConnectionInterface $connection boolcreateConstraints(Cake\Datasource\ConnectionInterface $connection): bool
Build and execute SQL queries necessary to create the constraints for the fixture
Cake\Datasource\ConnectionInterface $connection booldrop(Cake\Datasource\ConnectionInterface $connection): bool
Run after all tests executed, should remove the table/collection from the connection.
Cake\Datasource\ConnectionInterface $connection booldropConstraints(Cake\Datasource\ConnectionInterface $connection): bool
Build and execute SQL queries necessary to drop the constraints for the fixture
Cake\Datasource\ConnectionInterface $connection boolfetchTable(string|null $alias = null, array<string, mixed> $options = []): Cake\ORM\Table
Convenience method to get a table instance.
string|null $alias optional The alias name you want to get. Should be in CamelCase format. If null then the value of $defaultTable property is used.
array<string, mixed> $options optional The options you want to build the table with. If a table has already been loaded the registry options will be ignored.
Cake\ORM\TableCake\Core\Exception\CakeExceptiongetTableLocator(): Cake\ORM\Locator\LocatorInterface
Gets the table locator.
Cake\ORM\Locator\LocatorInterfacegetTableSchema(): Cake\Database\Schema\TableSchemaInterfaceCake\Database\Schema\SqlGeneratorInterface
Get and set the schema for this fixture.
Cake\Database\Schema\TableSchemaInterfaceCake\Database\Schema\SqlGeneratorInterfaceinit(): void
Initialize the fixture.
voidCake\ORM\Exception\MissingTableClassExceptioninsert(Cake\Datasource\ConnectionInterface $connection): Cake\Database\StatementInterface|bool
Run before each test is executed.
Should insert all the records into the test database.
Cake\Datasource\ConnectionInterface $connection Cake\Database\StatementInterface|boolsetTableLocator(Cake\ORM\Locator\LocatorInterface $tableLocator): $this
Sets the table locator.
Cake\ORM\Locator\LocatorInterface $tableLocator LocatorInterface instance.
$thissetTableSchema(Cake\Database\Schema\TableSchemaInterfaceCake\Database\Schema\SqlGeneratorInterface $schema): $this
Get and set the schema for this fixture.
Cake\Database\Schema\TableSchemaInterfaceCake\Database\Schema\SqlGeneratorInterface $schema $thissourceName(): string
Get the table/collection name for this fixture.
stringtruncate(Cake\Datasource\ConnectionInterface $connection): bool
Truncates the current fixture.
Cake\Datasource\ConnectionInterface $connection boolFixture constraints to be created.
array<string, mixed>The schema for this fixture.
Cake\Database\Schema\TableSchemaInterfaceCake\Database\Schema\SqlGeneratorInterfaceTable locator instance
Cake\ORM\Locator\LocatorInterface|nullFixture Datasource
stringThis object's default table alias.
string|nullFields / Schema for the fixture.
This array should be compatible with {@link \Cake\Database\Schema\Schema}. The _constraints, _options and _indexes keys are reserved for defining constraints, options and indexes respectively.
arrayConfiguration 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.
array|nullFixture records to be inserted.
arrayFull Table Name
string
© 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/4.4/class-Cake.TestSuite.Fixture.TestFixture.html