Interface FixtureInterface
Defines the interface that testing fixtures use.
Direct Implementers
Method Summary
- connection() publicGet the connection name this fixture should be inserted into.
- create() publicCreate the fixture schema/mapping/definition
- createConstraints() public
Build and execute SQL queries necessary to create the constraints for the fixture
- drop() publicRun after all tests executed, should remove the table/collection from the connection.
- dropConstraints() public
Build and execute SQL queries necessary to drop the constraints for the fixture
- insert() publicRun before each test is executed.
- sourceName() publicGet the table/collection name for this fixture.
- truncate() publicTruncates the current fixture.
Method Detail
connection()source public
connection( )
Get the connection name this fixture should be inserted into.
Returns
stringcreate()source public
create( Cake\Datasource\ConnectionInterface $db )
Create the fixture schema/mapping/definition
Parameters
-
Cake\Datasource\ConnectionInterface
$db
- An instance of the connection the fixture should be created on.
Returns
booleanTrue on success, false on failure.
createConstraints()source public
createConstraints( Cake\Datasource\ConnectionInterface $db )
Build and execute SQL queries necessary to create the constraints for the fixture
Parameters
-
Cake\Datasource\ConnectionInterface
$db
- An instance of the database into which the constraints will be created
Returns
booleanon success or if there are no constraints to create, or false on failure
drop()source public
drop( Cake\Datasource\ConnectionInterface $db )
Run after all tests executed, should remove the table/collection from the connection.
Parameters
-
Cake\Datasource\ConnectionInterface
$db
- An instance of the connection the fixture should be removed from.
Returns
booleanTrue on success, false on failure.
dropConstraints()source public
dropConstraints( Cake\Datasource\ConnectionInterface $db )
Build and execute SQL queries necessary to drop the constraints for the fixture
Parameters
-
Cake\Datasource\ConnectionInterface
$db
- An instance of the database into which the constraints will be dropped
Returns
booleanon success or if there are no constraints to drop, or false on failure
insert()source public
insert( Cake\Datasource\ConnectionInterface $db )
Run before each test is executed.
Should insert all the records into the test database.
Parameters
-
Cake\Datasource\ConnectionInterface
$db
- An instance of the connection into which the records will be inserted.
Returns
booleanon success or if there are no records to insert, or false on failure.
sourceName()source public
sourceName( )
Get the table/collection name for this fixture.
Returns
stringtruncate()source public
truncate( Cake\Datasource\ConnectionInterface $db )
Truncates the current fixture.
Parameters
-
Cake\Datasource\ConnectionInterface
$db
- A reference to a db instance
Returns
boolean
© 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.Datasource.FixtureInterface.html