W3cubDocs

/CakePHP 4.4

Interface FixtureInterface

Defines the interface that testing fixtures use.

Namespace: Cake\Datasource

Method Summary

  • connection() public

    Get the connection name this fixture should be inserted into.

  • create() public

    Create the fixture schema/mapping/definition

  • drop() public

    Run after all tests executed, should remove the table/collection from the connection.

  • insert() public

    Run before each test is executed.

  • sourceName() public

    Get the table/collection name for this fixture.

  • truncate() public

    Truncates the current fixture.

Method Detail

connection() public

connection(): string

Get the connection name this fixture should be inserted into.

Returns

string

create() public

create(Cake\Datasource\ConnectionInterface $connection): bool

Create the fixture schema/mapping/definition

Parameters

Cake\Datasource\ConnectionInterface $connection

An instance of the connection the fixture should be created on.

Returns

bool

drop() public

drop(Cake\Datasource\ConnectionInterface $connection): bool

Run after all tests executed, should remove the table/collection from the connection.

Parameters

Cake\Datasource\ConnectionInterface $connection

An instance of the connection the fixture should be removed from.

Returns

bool

insert() public

insert(Cake\Datasource\ConnectionInterface $connection): Cake\Database\StatementInterface|bool

Run before each test is executed.

Should insert all the records into the test database.

Parameters

Cake\Datasource\ConnectionInterface $connection

An instance of the connection into which the records will be inserted.

Returns

Cake\Database\StatementInterface|bool

sourceName() public

sourceName(): string

Get the table/collection name for this fixture.

Returns

string

truncate() public

truncate(Cake\Datasource\ConnectionInterface $connection): bool

Truncates the current fixture.

Parameters

Cake\Datasource\ConnectionInterface $connection

A reference to a db instance

Returns

bool

© 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/interface-Cake.Datasource.FixtureInterface.html