Interface FixtureInterface

Defines the interface that testing fixtures use.

Direct known implementers

Cake\TestSuite\Fixture\TestFixture

Method Detail

connectionsource public

connection( )

Get the connection name this fixture should be inserted into.

Returns

string
string

createsource 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

boolean
True on success, false on failure.

createConstraintssource 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

boolean
on success or if there are no constraints to create, or false on failure

dropsource 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

boolean
True on success, false on failure.

dropConstraintssource 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

boolean
on success or if there are no constraints to drop, or false on failure

insertsource 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

boolean
on success or if there are no records to insert, or false on failure.

sourceNamesource public

sourceName( )

Get the table/collection name for this fixture.

Returns

string
string

truncatesource public

truncate( Cake\Datasource\ConnectionInterface $db )

Truncates the current fixture.

Parameters

Cake\Datasource\ConnectionInterface $db
A reference to a db instance

Returns

boolean
bool

© 2005–2016 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.
http://api.cakephp.org/3.1/class-Cake.Datasource.FixtureInterface.html