Class CakeTestFixture
CakeTestFixture is responsible for building and destroying tables to be used during testing.
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/TestSuite/Fixture/CakeTestFixture.php
Method Detail
__constructsource public
__construct( )
Instantiate the fixture.
Throws
CakeException
on invalid datasource usage.
createsource public
create( DboSource $db )
Run before all tests execute, should return SQL statement to create table for this fixture could be executed successfully.
Parameters
-
DboSource
$db
- An instance of the database object used to create the fixture table
Returns
boolean
True on success, false on failure
dropsource public
drop( DboSource $db )
Run after all tests executed, should return SQL statement to drop table for this fixture.
Parameters
-
DboSource
$db
- An instance of the database object used to create the fixture table
Returns
boolean
True on success, false on failure
initsource public
init( )
Initialize the fixture.
Throws
MissingModelException
Whe importing from a model that does not exist.
insertsource public
insert( DboSource $db )
Run before each tests is executed, should return a set of SQL statements to insert records for the table of this fixture could be executed successfully.
Parameters
-
DboSource
$db
- An instance of the database into which the records will be inserted
Returns
boolean
on success or if there are no records to insert, or false on failure
Throws
CakeException
if counts of values and fields do not match.
truncatesource public
truncate( DboSource $db )
Truncates the current fixture. Can be overwritten by classes extending CakeFixture to trigger other events before / after truncate.
Parameters
-
DboSource
$db
- A reference to a db instance
Returns
boolean
bool
Properties summary
© 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/2.7/class-CakeTestFixture.html