Merge branch '1.3' into 1.3-bake

This commit is contained in:
AD7six 2009-07-27 22:39:24 +02:00
commit f9dc6b01c1
39 changed files with 142 additions and 13704 deletions

View file

@ -20,22 +20,27 @@
* @since CakePHP(tm) v 0.10.8.2117 * @since CakePHP(tm) v 0.10.8.2117
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* The settings below can be used to set additional paths to models, views and controllers. * The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
* *
* $modelPaths = array('/full/path/to/models/', '/next/full/path/to/models/'); * App::build(array(
* $viewPaths = array('/full/path/to/views/', '/next/full/path/to/views/'); * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* $controllerPaths = array(/full/path/to/controllers/', '/next/full/path/to/controllers/'); * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* $pluginPaths = array('/full/path/to/plugins/', '/next/full/path/to/plugins/'); * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* $behaviorPaths = array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'); * 'controllers' => array(/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* $componentPaths = array('/full/path/to/components/', '/next/full/path/to/components/'); * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* $helperPaths = array('/full/path/to/helpers/', '/next/full/path/to/helpers/'); * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* $vendorPaths = array('/full/path/to/vendors/', '/next/full/path/to/vendors/'); * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
* $shellPaths = array('/full/path/to/shells/', '/next/full/path/to/shells/'); * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
* $localePaths = array('/full/path/to/locale/', '/next/full/path/to/locale/'; * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
* 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* ));
* *
*/ */
/** /**
* As of 1.3, additional rules for the inflector are added below * As of 1.3, additional rules for the inflector are added below
* *

View file

@ -1,47 +1,51 @@
<?php <?php
/* SVN FILE: $Id$ */
/** /**
* Short description for file. * This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php
* *
* Long description for file * This is an application wide file to load any function that is not used within a class
* define. You can also use this to include or require any files in your application.
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
* *
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) * Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
* *
* Licensed under The MIT License * Licensed under The MIT License
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @filesource * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake * @package cake
* @subpackage cake.app.config * @subpackage cake.app.config
* @since CakePHP(tm) v 0.10.8.2117 * @since CakePHP(tm) v 0.10.8.2117
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/**
*
* This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
* This is an application wide file to load any function that is not used within a class define.
* You can also use this to include or require any files in your application.
*
*/
/** /**
* The settings below can be used to set additional paths to models, views and controllers. * The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
* *
* $modelPaths = array('full path to models', 'second full path to models', 'etc...'); * App::build(array(
* $viewPaths = array('this path to views', 'second full path to views', 'etc...'); * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...'); * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* 'controllers' => array(/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
* 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
* 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
* 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* ));
*
*/
/**
* As of 1.3, additional rules for the inflector are added below
*
* Inflector::rule('singular', array('rules' => array(), irregular' => array(), 'uninflected' => array()));
* Inflector::rule('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
* *
*/ */
//EOF
?> ?>

View file

@ -30,7 +30,8 @@
/** /**
* List of helpers to include * List of helpers to include
*/ */
App::import('Core', array('Router', 'Controller')); App::import('Core', 'Router');
App::import('Controller', 'Controller', false);
/** /**
* Dispatcher translates URLs to controller-action-paramter triads. * Dispatcher translates URLs to controller-action-paramter triads.
@ -692,7 +693,7 @@ class Dispatcher extends Object {
if (file_exists($filename)) { if (file_exists($filename)) {
if (!class_exists('View')) { if (!class_exists('View')) {
App::import('Core', 'View'); App::import('View', 'View', false);
} }
$controller = null; $controller = null;
$view =& new View($controller, false); $view =& new View($controller, false);

View file

@ -25,6 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Configuration class (singleton). Used for managing runtime configuration information. * Configuration class (singleton). Used for managing runtime configuration information.
* *
@ -43,14 +44,6 @@ class Configure extends Object {
*/ */
var $debug = null; var $debug = null;
/**
* Determines if $__objects cache should be written.
*
* @var boolean
* @access private
*/
var $__cache = false;
/** /**
* Returns a singleton instance of the Configure class. * Returns a singleton instance of the Configure class.
* *
@ -431,17 +424,6 @@ class Configure extends Object {
} }
} }
} }
/**
* Caches the object map when the instance of the Configure class is destroyed
*
* @access public
*/
function __destruct() {
if ($this->__cache) {
Cache::write('object_map', array_filter($this->__objects), '_cake_core_');
}
}
} }
/** /**
@ -721,6 +703,7 @@ class App extends Object {
$paths['cake'][] = $cake; $paths['cake'][] = $cake;
$paths['libs'][] = $libs; $paths['libs'][] = $libs;
$paths['models'][] = $libs . 'model' . DS; $paths['models'][] = $libs . 'model' . DS;
$paths['datasources'][] = $libs . 'model' . DS . 'datasources' . DS;
$paths['behaviors'][] = $libs . 'model' . DS . 'behaviors' . DS; $paths['behaviors'][] = $libs . 'model' . DS . 'behaviors' . DS;
$paths['controllers'][] = $libs . 'controller' . DS; $paths['controllers'][] = $libs . 'controller' . DS;
$paths['components'][] = $libs . 'controller' . DS . 'components' . DS; $paths['components'][] = $libs . 'controller' . DS . 'components' . DS;
@ -764,7 +747,7 @@ class App extends Object {
$_this->__objects = Cache::read('object_map', '_cake_core_'); $_this->__objects = Cache::read('object_map', '_cake_core_');
} }
if (empty($_this->__objects) || !isset($_this->__objects[$type]) || $cache !== true) { if (!isset($_this->__objects[$name]) || $cache !== true) {
$types = $_this->types; $types = $_this->types;
if (!isset($types[$type])) { if (!isset($types[$type])) {
@ -792,13 +775,13 @@ class App extends Object {
$objects[$key] = Inflector::camelize($value); $objects[$key] = Inflector::camelize($value);
} }
} }
if ($cache === true && !empty($objects)) {
$_this->__objects[$name] = $objects; if ($cache === true) {
$_this->__cache = true; $_this->__cache = true;
} else {
return $objects;
} }
$_this->__objects[$name] = $objects;
} }
return $_this->__objects[$name]; return $_this->__objects[$name];
} }
@ -984,12 +967,14 @@ class App extends Object {
} }
continue; continue;
} }
if (!isset($this->__paths[$path])) { if (!isset($this->__paths[$path])) {
if (!class_exists('Folder')) { if (!class_exists('Folder')) {
require LIBS . 'folder.php'; require LIBS . 'folder.php';
} }
$Folder =& new Folder(); $Folder =& new Folder();
$directories = $Folder->tree($path, false, 'dir'); $directories = $Folder->tree($path, array('.svn', 'tests', 'templates'), 'dir');
sort($directories);
$this->__paths[$path] = $directories; $this->__paths[$path] = $directories;
} }
@ -1103,7 +1088,7 @@ class App extends Object {
switch ($load) { switch ($load) {
case 'model': case 'model':
if (!class_exists('Model')) { if (!class_exists('Model')) {
App::import('Core', 'Model', false, App::core('models')); App::import('Model', 'Model', false, App::core('models'));
} }
if (!class_exists('AppModel')) { if (!class_exists('AppModel')) {
App::import($type, 'AppModel', false, App::path('models')); App::import($type, 'AppModel', false, App::path('models'));
@ -1173,22 +1158,15 @@ class App extends Object {
*/ */
function __paths($type) { function __paths($type) {
$type = strtolower($type); $type = strtolower($type);
$paths = array();
if ($type === 'core') { if ($type === 'core') {
$path = App::core(); return App::core('libs');
$paths = array();
foreach ($path as $key => $value) {
$count = count($key);
for ($i = 0; $i < $count; $i++) {
$paths[] = $path[$key][$i];
}
}
return $paths;
} }
if ($paths = App::path($type .'s')) { if ($paths = App::path($type .'s')) {
return $paths; return $paths;
} }
return $paths;
} }
/** /**
@ -1255,6 +1233,7 @@ class App extends Object {
unset($this->__paths[rtrim($core[0], DS)]); unset($this->__paths[rtrim($core[0], DS)]);
Cache::write('dir_map', array_filter($this->__paths), '_cake_core_'); Cache::write('dir_map', array_filter($this->__paths), '_cake_core_');
Cache::write('file_map', array_filter($this->__map), '_cake_core_'); Cache::write('file_map', array_filter($this->__map), '_cake_core_');
Cache::write('object_map', $this->__objects, '_cake_core_');
} }
} }
} }

View file

@ -25,6 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Multibyte');
/** /**
* EmailComponent * EmailComponent
@ -36,7 +37,6 @@
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
* *
*/ */
App::import('Core', 'Multibyte');
class EmailComponent extends Object{ class EmailComponent extends Object{
/** /**

View file

@ -21,8 +21,8 @@
/** /**
* Include files * Include files
*/ */
App::import('Core', array('Component', 'View')); App::import('Controller', 'Component', false);
App::import('View', 'View', false);
/** /**
* Controller * Controller
* *

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'DboMysql'); App::import('Datasource', 'DboMysql');
/** /**
* MySQLi DBO driver object * MySQLi DBO driver object

View file

@ -24,8 +24,9 @@
* Included libs * Included libs
*/ */
App::import('Core', array( App::import('Core', array(
'ClassRegistry', 'Overloadable', 'Validation', 'ModelBehavior', 'ConnectionManager', 'Set', 'String' 'ClassRegistry', 'Overloadable', 'Validation', 'Set', 'String'
)); ));
App::import('Model', array('ModelBehavior', 'ConnectionManager'), false);
/** /**
* Object-relational mapper. * Object-relational mapper.

View file

@ -31,7 +31,7 @@
* *
*/ */
if (!class_exists('Object')) { if (!class_exists('Object')) {
App::import('Core', 'Object'); require LIBS . 'object.php';
} }
/** /**

View file

@ -26,7 +26,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Helper'); App::import('View', 'Helper', false);
/** /**
* This is a placeholder class. * This is a placeholder class.

View file

@ -27,7 +27,8 @@
/** /**
* Included libraries. * Included libraries.
*/ */
App::import('Core', array('Helper', 'ClassRegistry')); App::import('Core', 'ClassRegistry');
App::import('View', 'Helper', false);
/** /**
* View, the V in the MVC triad. * View, the V in the MVC triad.

View file

@ -109,6 +109,16 @@ class TestShellDispatcher extends ShellDispatcher {
} }
} }
/**
* clear method
*
* @access public
* @return void
*/
function clear() {
}
/** /**
* _stop method * _stop method
* *

View file

@ -23,7 +23,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -23,7 +23,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -18,7 +18,7 @@
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -25,7 +25,9 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', array('Shell', 'Folder')); App::import('Core', 'Folder');
App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);
@ -350,7 +352,7 @@ class ShellTest extends CakeTestCase {
* @access public * @access public
*/ */
function testCreateFileWindows() { function testCreateFileWindows() {
$this->skipUnless(DIRECTORY_SEPARATOR === '\\', '%s Supported on Windows only'); $this->skipUnless(DIRECTORY_SEPARATOR === '\\', 'testCreateFileWindows supported on Windows only');
$path = TMP . 'shell_test'; $path = TMP . 'shell_test';
$file = $path . DS . 'file1.php'; $file = $path . DS . 'file1.php';

View file

@ -17,7 +17,9 @@
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Shell'); App::import('Core', 'ClassRegistry');
App::import('View', 'Helper', false);
App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -17,7 +17,7 @@
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);
@ -54,7 +54,7 @@ class TEST_DATABASE_CONFIG {
'database' => 'database_name', 'database' => 'database_name',
'prefix' => '', 'prefix' => '',
); );
var $otherOne = array( var $otherOne = array(
'driver' => 'mysql', 'driver' => 'mysql',
'persistent' => false, 'persistent' => false,
@ -73,7 +73,6 @@ class TEST_DATABASE_CONFIG {
* @subpackage cake.tests.cases.console.libs.tasks * @subpackage cake.tests.cases.console.libs.tasks
*/ */
class DbConfigTaskTest extends CakeTestCase { class DbConfigTaskTest extends CakeTestCase {
/** /**
* startTest method * startTest method
* *
@ -89,7 +88,6 @@ class DbConfigTaskTest extends CakeTestCase {
$this->Task->params['working'] = rtrim(APP, '/'); $this->Task->params['working'] = rtrim(APP, '/');
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG'; $this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
} }
/** /**
* endTest method * endTest method
* *
@ -100,7 +98,6 @@ class DbConfigTaskTest extends CakeTestCase {
unset($this->Task, $this->Dispatcher); unset($this->Task, $this->Dispatcher);
ClassRegistry::flush(); ClassRegistry::flush();
} }
/** /**
* Test the getConfig method. * Test the getConfig method.
* *
@ -111,7 +108,6 @@ class DbConfigTaskTest extends CakeTestCase {
$result = $this->Task->getConfig(); $result = $this->Task->getConfig();
$this->assertEqual($result, 'otherOne'); $this->assertEqual($result, 'otherOne');
} }
/** /**
* test that initialize sets the path up. * test that initialize sets the path up.
* *
@ -122,9 +118,8 @@ class DbConfigTaskTest extends CakeTestCase {
$this->Task->initialize(); $this->Task->initialize();
$this->assertFalse(empty($this->Task->path)); $this->assertFalse(empty($this->Task->path));
$this->assertEqual($this->Task->path, APP . 'config' . DS); $this->assertEqual($this->Task->path, APP . 'config' . DS);
} }
/** /**
* test execute and by extension __interactive * test execute and by extension __interactive
* *

View file

@ -25,7 +25,8 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', array('Shell', 'Folder')); App::import('Core', 'Folder');
App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -17,7 +17,7 @@
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);
@ -47,7 +47,6 @@ Mock::generatePartial(
'Shell', 'MockFixtureModelTask', 'Shell', 'MockFixtureModelTask',
array('in', 'out', 'err', 'createFile', '_stop', 'getName', 'getTable', 'listAll') array('in', 'out', 'err', 'createFile', '_stop', 'getName', 'getTable', 'listAll')
); );
/** /**
* FixtureTaskTest class * FixtureTaskTest class
* *
@ -55,14 +54,12 @@ Mock::generatePartial(
* @subpackage cake.tests.cases.console.libs.tasks * @subpackage cake.tests.cases.console.libs.tasks
*/ */
class FixtureTaskTest extends CakeTestCase { class FixtureTaskTest extends CakeTestCase {
/** /**
* fixtures * fixtures
* *
* @var array * @var array
**/ **/
var $fixtures = array('core.article', 'core.comment'); var $fixtures = array('core.article', 'core.comment');
/** /**
* startTest method * startTest method
* *
@ -78,7 +75,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->Dispatch->shellPaths = App::path('shells'); $this->Task->Dispatch->shellPaths = App::path('shells');
$this->Task->Template->initialize(); $this->Task->Template->initialize();
} }
/** /**
* endTest method * endTest method
* *
@ -89,7 +85,6 @@ class FixtureTaskTest extends CakeTestCase {
unset($this->Task, $this->Dispatcher); unset($this->Task, $this->Dispatcher);
ClassRegistry::flush(); ClassRegistry::flush();
} }
/** /**
* test that initialize sets the path * test that initialize sets the path
* *
@ -102,7 +97,6 @@ class FixtureTaskTest extends CakeTestCase {
$expected = '/my/path/tests/fixtures/'; $expected = '/my/path/tests/fixtures/';
$this->assertEqual($Task->path, $expected); $this->assertEqual($Task->path, $expected);
} }
/** /**
* test import option array generation * test import option array generation
* *
@ -123,7 +117,7 @@ class FixtureTaskTest extends CakeTestCase {
$result = $this->Task->importOptions('Article'); $result = $this->Task->importOptions('Article');
$expected = array(); $expected = array();
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Task->setReturnValueAt(5, 'in', 'n'); $this->Task->setReturnValueAt(5, 'in', 'n');
$this->Task->setReturnValueAt(6, 'in', 'n'); $this->Task->setReturnValueAt(6, 'in', 'n');
$this->Task->setReturnValueAt(7, 'in', 'y'); $this->Task->setReturnValueAt(7, 'in', 'y');
@ -131,7 +125,6 @@ class FixtureTaskTest extends CakeTestCase {
$expected = array('fromTable' => true); $expected = array('fromTable' => true);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
/** /**
* test generating a fixture with database conditions. * test generating a fixture with database conditions.
* *
@ -150,7 +143,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->assertPattern('/Second Article/', $result, 'Missing import data %s'); $this->assertPattern('/Second Article/', $result, 'Missing import data %s');
$this->assertPattern('/Third Article/', $result, 'Missing import data %s'); $this->assertPattern('/Third Article/', $result, 'Missing import data %s');
} }
/** /**
* test that execute passes runs bake depending with named model. * test that execute passes runs bake depending with named model.
* *
@ -164,7 +156,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/'))); $this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
$this->Task->execute(); $this->Task->execute();
} }
/** /**
* test that execute runs all() when args[0] = all * test that execute runs all() when args[0] = all
* *
@ -184,7 +175,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/'))); $this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/')));
$this->Task->execute(); $this->Task->execute();
} }
/** /**
* test interactive mode of execute * test interactive mode of execute
* *
@ -193,7 +183,7 @@ class FixtureTaskTest extends CakeTestCase {
function testExecuteInteractive() { function testExecuteInteractive() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
$this->Task->setReturnValue('in', 'y'); $this->Task->setReturnValue('in', 'y');
$this->Task->Model->setReturnValue('getName', 'Article'); $this->Task->Model->setReturnValue('getName', 'Article');
$this->Task->Model->setReturnValue('getTable', 'articles', array('Article')); $this->Task->Model->setReturnValue('getTable', 'articles', array('Article'));
@ -202,7 +192,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/'))); $this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
$this->Task->execute(); $this->Task->execute();
} }
/** /**
* Test that bake works * Test that bake works
* *
@ -236,7 +225,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->assertNoPattern('/var \$fields/', $result); $this->assertNoPattern('/var \$fields/', $result);
$this->assertNoPattern('/var \$records/', $result); $this->assertNoPattern('/var \$records/', $result);
} }
/** /**
* Test that file generation includes headers and correct path for plugins. * Test that file generation includes headers and correct path for plugins.
* *
@ -253,7 +241,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/\<\?php(.*)\?\>/ms'))); $this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/\<\?php(.*)\?\>/ms')));
$result = $this->Task->generateFixtureFile('Article', array()); $result = $this->Task->generateFixtureFile('Article', array());
} }
/** /**
* test generating files into plugins. * test generating files into plugins.
* *

View file

@ -20,7 +20,7 @@
* @since CakePHP v 1.3 * @since CakePHP v 1.3
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -22,7 +22,7 @@
* @since CakePHP v 1.3.0 * @since CakePHP v 1.3.0
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -20,7 +20,7 @@
* @since CakePHP v 1.3.0 * @since CakePHP v 1.3.0
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -20,7 +20,7 @@
* @since CakePHP(tm) v 1.3 * @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -1,6 +1,5 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* TestTaskTest file * TestTaskTest file
* *
@ -22,8 +21,9 @@
* @since CakePHP v 1.2.0.7726 * @since CakePHP v 1.2.0.7726
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
App::import('Core', array('Controller', 'Model')); App::import('Controller', 'Controller', false);
App::import('Model', 'Model', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);
@ -92,12 +92,11 @@ class TestTaskTag extends Model {
) )
); );
} }
/** /**
* Simulated Plugin * Simulated Plugin
**/ **/
class TestTaskAppModel extends Model { class TestTaskAppModel extends Model {
} }
class TestTaskComment extends TestTaskAppModel { class TestTaskComment extends TestTaskAppModel {
var $name = 'TestTaskComment'; var $name = 'TestTaskComment';
@ -124,7 +123,6 @@ class TestTaskCommentsController extends Controller {
class TestTaskTest extends CakeTestCase { class TestTaskTest extends CakeTestCase {
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/** /**
* startTest method * startTest method
* *
@ -138,7 +136,6 @@ class TestTaskTest extends CakeTestCase {
$this->Task->Dispatch =& $this->Dispatcher; $this->Task->Dispatch =& $this->Dispatcher;
$this->Task->Template =& new TemplateTask($this->Dispatcher); $this->Task->Template =& new TemplateTask($this->Dispatcher);
} }
/** /**
* endTest method * endTest method
* *
@ -148,7 +145,6 @@ class TestTaskTest extends CakeTestCase {
function endTest() { function endTest() {
ClassRegistry::flush(); ClassRegistry::flush();
} }
/** /**
* Test that file path generation doesn't continuously append paths. * Test that file path generation doesn't continuously append paths.
* *
@ -172,9 +168,8 @@ class TestTaskTest extends CakeTestCase {
$this->Task->expectAt(2, 'createFile', array($file, '*')); $this->Task->expectAt(2, 'createFile', array($file, '*'));
$this->Task->bake('Controller', 'Comments'); $this->Task->bake('Controller', 'Comments');
} }
/** /**
* Test that method introspection pulls all relevant non parent class * Test that method introspection pulls all relevant non parent class
* methods into the test case. * methods into the test case.
* *
* @return void * @return void
@ -184,7 +179,6 @@ class TestTaskTest extends CakeTestCase {
$expected = array('doSomething', 'doSomethingElse'); $expected = array('doSomething', 'doSomethingElse');
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
/** /**
* test that the generation of fixtures works correctly. * test that the generation of fixtures works correctly.
* *
@ -193,12 +187,11 @@ class TestTaskTest extends CakeTestCase {
function testFixtureArrayGenerationFromModel() { function testFixtureArrayGenerationFromModel() {
$subject = ClassRegistry::init('TestTaskArticle'); $subject = ClassRegistry::init('TestTaskArticle');
$result = $this->Task->generateFixtureList($subject); $result = $this->Task->generateFixtureList($subject);
$expected = array('plugin.test_task.test_task_comment', 'app.articles_tags', $expected = array('plugin.test_task.test_task_comment', 'app.articles_tags',
'app.test_task_article', 'app.test_task_tag'); 'app.test_task_article', 'app.test_task_tag');
$this->assertEqual(sort($result), sort($expected)); $this->assertEqual(sort($result), sort($expected));
} }
/** /**
* test that the generation of fixtures works correctly. * test that the generation of fixtures works correctly.
* *
@ -207,12 +200,11 @@ class TestTaskTest extends CakeTestCase {
function testFixtureArrayGenerationFromController() { function testFixtureArrayGenerationFromController() {
$subject = new TestTaskCommentsController(); $subject = new TestTaskCommentsController();
$result = $this->Task->generateFixtureList($subject); $result = $this->Task->generateFixtureList($subject);
$expected = array('plugin.test_task.test_task_comment', 'app.articles_tags', $expected = array('plugin.test_task.test_task_comment', 'app.articles_tags',
'app.test_task_article', 'app.test_task_tag'); 'app.test_task_article', 'app.test_task_tag');
$this->assertEqual(sort($result), sort($expected)); $this->assertEqual(sort($result), sort($expected));
} }
/** /**
* test user interaction to get object type * test user interaction to get object type
* *
@ -227,7 +219,6 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getObjectType(); $result = $this->Task->getObjectType();
$this->assertEqual($result, $this->Task->classTypes[1]); $this->assertEqual($result, $this->Task->classTypes[1]);
} }
/** /**
* creating test subjects should clear the registry so the registry is always fresh * creating test subjects should clear the registry so the registry is always fresh
* *
@ -251,7 +242,6 @@ class TestTaskTest extends CakeTestCase {
$keys = ClassRegistry::keys(); $keys = ClassRegistry::keys();
$this->assertFalse(in_array('random', $keys)); $this->assertFalse(in_array('random', $keys));
} }
/** /**
* test that getClassName returns the user choice as a classname. * test that getClassName returns the user choice as a classname.
* *
@ -272,7 +262,6 @@ class TestTaskTest extends CakeTestCase {
$options = Configure::listObjects('model'); $options = Configure::listObjects('model');
$this->assertEqual($result, $options[0]); $this->assertEqual($result, $options[0]);
} }
/** /**
* Test the user interaction for defining additional fixtures. * Test the user interaction for defining additional fixtures.
* *
@ -285,7 +274,6 @@ class TestTaskTest extends CakeTestCase {
$expected = array('app.pizza', 'app.topping', 'app.side_dish'); $expected = array('app.pizza', 'app.topping', 'app.side_dish');
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
/** /**
* test that resolving classnames works * test that resolving classnames works
* *
@ -307,7 +295,6 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getRealClassname('Component', 'Auth'); $result = $this->Task->getRealClassname('Component', 'Auth');
$this->assertEqual($result, 'AuthComponent'); $this->assertEqual($result, 'AuthComponent');
} }
/** /**
* test baking files. * test baking files.
* *
@ -336,7 +323,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertPattern("/'app\.test_task_tag'/", $result); $this->assertPattern("/'app\.test_task_tag'/", $result);
$this->assertPattern("/'app\.articles_tag'/", $result); $this->assertPattern("/'app\.articles_tag'/", $result);
} }
/** /**
* test baking controller test files, ensure that the stub class is generated. * test baking controller test files, ensure that the stub class is generated.
* *
@ -366,7 +352,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertPattern("/'app\.test_task_tag'/", $result); $this->assertPattern("/'app\.test_task_tag'/", $result);
$this->assertPattern("/'app\.articles_tag'/", $result); $this->assertPattern("/'app\.articles_tag'/", $result);
} }
/** /**
* test Constructor generation ensure that constructClasses is called for controllers * test Constructor generation ensure that constructClasses is called for controllers
* *
@ -385,7 +370,6 @@ class TestTaskTest extends CakeTestCase {
$expected = "new FormHelper()\n"; $expected = "new FormHelper()\n";
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
/** /**
* Test that mock class generation works for the appropriate classes * Test that mock class generation works for the appropriate classes
* *
@ -395,7 +379,6 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->hasMockClass('controller'); $result = $this->Task->hasMockClass('controller');
$this->assertTrue($result); $this->assertTrue($result);
} }
/** /**
* test bake() with a -plugin param * test bake() with a -plugin param
* *
@ -408,7 +391,6 @@ class TestTaskTest extends CakeTestCase {
$this->Task->expectAt(0, 'createFile', array($path, '*')); $this->Task->expectAt(0, 'createFile', array($path, '*'));
$this->Task->bake('Helper', 'Form'); $this->Task->bake('Helper', 'Form');
} }
/** /**
* Test filename generation for each type + plugins * Test filename generation for each type + plugins
* *
@ -442,7 +424,6 @@ class TestTaskTest extends CakeTestCase {
$expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php'; $expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
/** /**
* test execute with a type defined * test execute with a type defined
* *
@ -455,7 +436,6 @@ class TestTaskTest extends CakeTestCase {
$this->Task->expectAt(0, 'createFile', array('*', new PatternExpectation('/class TestTaskTagTestCase extends CakeTestCase/'))); $this->Task->expectAt(0, 'createFile', array('*', new PatternExpectation('/class TestTaskTagTestCase extends CakeTestCase/')));
$this->Task->execute(); $this->Task->execute();
} }
/** /**
* test execute with type and class name defined * test execute with type and class name defined
* *

View file

@ -20,7 +20,7 @@
* @since CakePHP v 1.2.0.7726 * @since CakePHP v 1.2.0.7726
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Shell'); App::import('Shell', 'Shell', false);
if (!defined('DISABLE_AUTO_DISPATCH')) { if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true); define('DISABLE_AUTO_DISPATCH', true);

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
App::import('Core', 'DboSource'); App::import('Datasource', 'DboSource', false);
/** /**
* CakeTestFixtureTestFixture class * CakeTestFixtureTestFixture class

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
App::import('Core', 'CodeCoverageManager'); require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cli_reporter.php'; require_once CAKE . 'tests' . DS . 'lib' . DS . 'cli_reporter.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_reporter.php'; require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_reporter.php';

View file

@ -121,23 +121,21 @@ class ConfigureTest extends CakeTestCase {
Configure::write('SomeName.someKey', null); Configure::write('SomeName.someKey', null);
$result = Configure::read('SomeName.someKey'); $result = Configure::read('SomeName.someKey');
$this->assertEqual($result, null); $this->assertEqual($result, null);
$expected = array('One' => array('Two' => array('Three' => array('Four' => array('Five' => 'cool'))))); $expected = array('One' => array('Two' => array('Three' => array('Four' => array('Five' => 'cool')))));
Configure::write('Key', $expected); Configure::write('Key', $expected);
$result = Configure::read('Key'); $result = Configure::read('Key');
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$result = Configure::read('Key.One'); $result = Configure::read('Key.One');
$this->assertEqual($expected['One'], $result); $this->assertEqual($expected['One'], $result);
$result = Configure::read('Key.One.Two'); $result = Configure::read('Key.One.Two');
$this->assertEqual($expected['One']['Two'], $result); $this->assertEqual($expected['One']['Two'], $result);
$result = Configure::read('Key.One.Two.Three.Four.Five'); $result = Configure::read('Key.One.Two.Three.Four.Five');
$this->assertEqual('cool', $result); $this->assertEqual('cool', $result);
} }
/** /**
@ -385,7 +383,16 @@ class AppImportTest extends UnitTestCase {
$file = App::import(); $file = App::import();
$this->assertTrue($file); $this->assertTrue($file);
$file = App::import('Core', 'Model', false); $file = App::import('Model', 'Model', false);
$this->assertTrue($file);
$file = App::import('Controller', 'Controller', false);
$this->assertTrue($file);
$file = App::import('Component', 'Component', false);
$this->assertTrue($file);
$file = App::import('Shell', 'Shell', false);
$this->assertTrue($file); $this->assertTrue($file);
$file = App::import('Model', 'SomeRandomModelThatDoesNotExist', false); $file = App::import('Model', 'SomeRandomModelThatDoesNotExist', false);

View file

@ -25,7 +25,8 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
App::import('Core', array('Component', 'Controller')); App::import('Controller', 'Controller', false);
App::import('Controller', 'Component', false);
if (!class_exists('AppController')) { if (!class_exists('AppController')) {

View file

@ -25,8 +25,8 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
App::import('Core', array('Component', 'Controller', 'Cookie')); App::import('Controller', array('Component', 'Controller'), false);
App::import('Component', 'Cookie');
/** /**
* CookieComponentTestController class * CookieComponentTestController class
* *

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
App::import('Core', array('Controller')); App::import('Controller', 'Controller', false);
App::import('Component', array('RequestHandler')); App::import('Component', array('RequestHandler'));
Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop')); Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop'));

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
App::import('Core', array('Controller', 'Object')); App::import('Controller', 'Controller', false);
App::import('Component', 'Session'); App::import('Component', 'Session');
/** /**

View file

@ -19,7 +19,7 @@
* @since CakePHP(tm) v 1.2.0.5436 * @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'Controller'); App::import('Controller', 'Controller', false);
App::import('Component', 'Security'); App::import('Component', 'Security');
App::import('Component', 'Cookie'); App::import('Component', 'Cookie');

View file

@ -30,7 +30,7 @@ if (!class_exists('AppController')) {
} elseif (!defined('APP_CONTROLLER_EXISTS')) { } elseif (!defined('APP_CONTROLLER_EXISTS')) {
define('APP_CONTROLLER_EXISTS', true); define('APP_CONTROLLER_EXISTS', true);
} }
App::import('Core', array('Controller', 'PagesController')); App::import('Controller', 'Pages');
/** /**
* PagesControllerTest class * PagesControllerTest class

View file

@ -42,10 +42,12 @@ class I18nTest extends CakeTestCase {
* @return void * @return void
*/ */
function setUp() { function setUp() {
Cache::delete('object_map', '_cake_core_');
App::build(array( App::build(array(
'locales' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'locale'), 'locales' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'locale'),
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins') 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins')
)); ), true);
App::objects('plugin', null, false);
} }
/** /**
@ -55,7 +57,9 @@ class I18nTest extends CakeTestCase {
* @return void * @return void
*/ */
function tearDown() { function tearDown() {
Cache::delete('object_map', '_cake_core_');
App::build(); App::build();
App::objects('plugin', null, false);
} }
/** /**

File diff suppressed because it is too large Load diff

View file

@ -3656,56 +3656,7 @@ class ModelReadTest extends BaseModelTest {
$expected = array('prev' => $two, 'next' => null); $expected = array('prev' => $two, 'next' => null);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
/**
* test findNeighbours() method
*
* @return void
* @access public
*/
function testFindNeighboursLegacy() {
$this->loadFixtures('User', 'Article');
$TestModel =& new Article();
$result = $TestModel->findNeighbours(null, 'Article.id', '2');
$expected = array(
'prev' => array(
'Article' => array(
'id' => 1
)),
'next' => array(
'Article' => array(
'id' => 3
)));
$this->assertEqual($result, $expected);
$result = $TestModel->findNeighbours(null, 'Article.id', '3');
$expected = array(
'prev' => array(
'Article' => array(
'id' => 2
)),
'next' => array()
);
$this->assertEqual($result, $expected);
$result = $TestModel->findNeighbours(
array('User.id' => 1),
array('Article.id', 'Article.title'),
2
);
$expected = array(
'prev' => array(
'Article' => array(
'id' => 1,
'title' => 'First Article'
)),
'next' => array(
'Article' => array(
'id' => 3,
'title' => 'Third Article'
)));
$this->assertEqual($result, $expected);
}
/** /**
* testFindCombinedRelations method * testFindCombinedRelations method
* *

View file

@ -120,6 +120,7 @@ class CacheHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function tearDown() { function tearDown() {
clearCache();
unset($this->Cache); unset($this->Cache);
} }