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

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.5
      • 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
 1: <?php
 2: /**
 3:  * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
 4:  * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 5:  *
 6:  * Licensed under The MIT License
 7:  * For full copyright and license information, please see the LICENSE.txt
 8:  * Redistributions of files must retain the above copyright notice
 9:  *
10:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11:  * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
12:  * @package       Cake.TestSuite.Fixture
13:  * @since         CakePHP(tm) v 1.2.0.4667
14:  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
15:  */
16: 
17: App::uses('Model', 'Model');
18: 
19: /**
20:  * A model to extend from to help you during testing.
21:  *
22:  * @package       Cake.TestSuite.Fixture
23:  */
24: class CakeTestModel extends Model {
25: 
26:     public $useDbConfig = 'test';
27: 
28:     public $cacheSources = false;
29: 
30: /**
31:  * Sets default order for the model to avoid failing tests caused by
32:  * incorrect order when no order has been defined in the finds.
33:  * Postgres can return the results in any order it considers appropriate if none is specified
34:  *
35:  * @param int|string|array $id Set this ID for this model on startup, can also be an array of options, see above.
36:  * @param string $table Name of database table to use.
37:  * @param string $ds DataSource connection name.
38:  */
39:     public function __construct($id = false, $table = null, $ds = null) {
40:         parent::__construct($id, $table, $ds);
41:         $this->order = array($this->alias . '.' . $this->primaryKey => 'ASC');
42:     }
43: 
44: /**
45:  * Overriding save() to set CakeTestSuiteDispatcher::date() as formatter for created, modified and updated fields
46:  *
47:  * @param array $data Data to save
48:  * @param bool|array $validate Validate or options.
49:  * @param array $fieldList Whitelist of fields
50:  * @return mixed
51:  */
52:     public function save($data = null, $validate = true, $fieldList = array()) {
53:         $db = $this->getDataSource();
54:         $db->columns['datetime']['formatter'] = 'CakeTestSuiteDispatcher::date';
55:         return parent::save($data, $validate, $fieldList);
56:     }
57: 
58: }
59: 
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