Class CakeTestFixture
CakeTestFixture is responsible for building and destroying tables to be used during testing.
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/TestSuite/Fixture/CakeTestFixture.php
Properties summary
-
$created
publicarray
List of datasources where this fixture has been created -
$db
publicobject
Cake's DBO driver (e.g: DboMysql). -
$name
publicstring
Name of the object -
$table
publicstring
Full Table Name -
$useDbConfig
publicstring
Fixture Datasource
Method Summary
-
__construct() public
Instantiate the fixture. -
create() public
Run before all tests execute, should return SQL statement to create table for this fixture could be executed successfully. -
drop() public
Run after all tests executed, should return SQL statement to drop table for this fixture. -
init() public
Initialize the fixture. -
insert() public
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.
-
truncate() public
Truncates the current fixture. Can be overwritten by classes extending CakeFixture to trigger other events before / after truncate.
Method Detail
create() public ¶
create( object $db )
Run before all tests execute, should return SQL statement to create table for this fixture could be executed successfully.
Parameters
- object $db
- An instance of the database object used to create the fixture table
Returns
True on success, false on failure
drop() public ¶
drop( object $db )
Run after all tests executed, should return SQL statement to drop table for this fixture.
Parameters
- object $db
- An instance of the database object used to create the fixture table
Returns
True on success, false on failure
insert() public ¶
insert( object $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
- object $db
- An instance of the database into which the records will be inserted
Returns
on success or if there are no records to insert, or false on failure
truncate() public ¶
truncate( object $db )
Truncates the current fixture. Can be overwritten by classes extending CakeFixture to trigger other events before / after truncate.
Parameters
- object $db
- A reference to a db instance