CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.1 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.1
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
    • Network
      • Email
      • Http
    • Routing
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • CakeFixtureManager
  • CakeTestFixture
  • CakeTestModel

Class CakeTestFixture

CakeTestFixture is responsible for building and destroying tables to be used during testing.

Package: Cake\TestSuite\Fixture
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 public
    array
    List of datasources where this fixture has been created
  • $db public
    object
    Cake's DBO driver (e.g: DboMysql).
  • $name public
    string
    Name of the object
  • $table public
    string
    Full Table Name
  • $useDbConfig public
    string
    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

__construct() public ¶

__construct( )

Instantiate the fixture.

Throws
CakeException
on invalid datasource usage.

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
boolean
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
boolean
True on success, false on failure

init() public ¶

init( )

Initialize the fixture.

Throws
MissingModelException
Whe importing from a model that does not exist.

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
boolean
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
Returns
boolean

Properties detail

$created ¶

public array

List of datasources where this fixture has been created

array()

$db ¶

public object

Cake's DBO driver (e.g: DboMysql).

null

$name ¶

public string

Name of the object

null

$table ¶

public string

Full Table Name

null

$useDbConfig ¶

public string

Fixture Datasource

'test'
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs