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.7 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.7
      • 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
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • CakeFixtureManager
  • CakeTestFixture
  • CakeTestModel

Class CakeFixtureManager

A factory class to manage the life cycle of test fixtures

Package: Cake\TestSuite\Fixture
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/TestSuite/Fixture/CakeFixtureManager.php

Properties summary

  • $_db protected
    DataSource
    Default datasource to use
  • $_fixtureMap protected
    array
    Holds the fixture classes that where instantiated indexed by class name
  • $_initialized protected
    boolean
    Was this class already initialized?
  • $_loaded protected
    array
    Holds the fixture classes that where instantiated

Method Summary

  • _initDb() protected
    Initializes this class with a DataSource object to use as default for all fixtures
  • _loadFixtures() protected
    Looks for fixture files and instantiates the classes accordingly
  • _parseFixturePath() protected

    Parse the fixture path included in test cases, to get the fixture class name, and the real fixture path including sub-directories

  • _setupTable() protected
    Runs the drop and create commands on the fixtures if necessary.
  • fixturize() public
    Inspects the test to look for unloaded fixtures and loads them
  • load() public
    Creates the fixtures tables and inserts data on them.
  • loadSingle() public
    Creates a single fixture table and loads data into it.
  • shutDown() public
    Drop all fixture tables loaded by this class
  • unload() public
    Truncates the fixtures tables

Method Detail

_initDb() protected ¶

_initDb( )

Initializes this class with a DataSource object to use as default for all fixtures

_loadFixtures() protected ¶

_loadFixtures( array $fixtures )

Looks for fixture files and instantiates the classes accordingly

Parameters
array $fixtures
the fixture names to load using the notation {type}.{name}
Throws
UnexpectedValueException
when a referenced fixture does not exist.

_parseFixturePath() protected ¶

_parseFixturePath( string $fixturePath )

Parse the fixture path included in test cases, to get the fixture class name, and the real fixture path including sub-directories

Parameters
string $fixturePath
the fixture path to parse
Returns
array
containing fixture class name and optional additional path

_setupTable() protected ¶

_setupTable( CakeTestFixture $fixture , DataSource $db = null , boolean $drop = true )

Runs the drop and create commands on the fixtures if necessary.

Parameters
CakeTestFixture $fixture
the fixture object to create
DataSource $db optional null
the datasource instance to use
boolean $drop optional true
whether drop the fixture if it is already created or not

fixturize() public ¶

fixturize( CakeTestCase $test )

Inspects the test to look for unloaded fixtures and loads them

Parameters
CakeTestCase $test
the test case to inspect

load() public ¶

load( CakeTestCase $test )

Creates the fixtures tables and inserts data on them.

Parameters
CakeTestCase $test
the test to inspect for fixture loading

loadSingle() public ¶

loadSingle( string $name , DataSource $db = null , boolean $dropTables = true )

Creates a single fixture table and loads data into it.

Parameters
string $name
of the fixture
DataSource $db optional null
DataSource instance or leave null to get DataSource from the fixture
boolean $dropTables optional true
Whether or not tables should be dropped and re-created.
Throws
UnexpectedValueException
if $name is not a previously loaded class

shutDown() public ¶

shutDown( )

Drop all fixture tables loaded by this class

This will also close the session, as failing to do so will cause fatal errors with database sessions.

unload() public ¶

unload( CakeTestCase $test )

Truncates the fixtures tables

Parameters
CakeTestCase $test
the test to inspect for fixture unloading

Properties detail

$_db ¶

protected DataSource

Default datasource to use

null

$_fixtureMap ¶

protected array

Holds the fixture classes that where instantiated indexed by class name

array()

$_initialized ¶

protected boolean

Was this class already initialized?

false

$_loaded ¶

protected array

Holds the fixture classes that where instantiated

array()
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