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
* @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.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
* $modelPaths = array('/full/path/to/models/', '/next/full/path/to/models/');
* $viewPaths = array('/full/path/to/views/', '/next/full/path/to/views/');
* $controllerPaths = array(/full/path/to/controllers/', '/next/full/path/to/controllers/');
* $pluginPaths = array('/full/path/to/plugins/', '/next/full/path/to/plugins/');
* $behaviorPaths = array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/');
* $componentPaths = array('/full/path/to/components/', '/next/full/path/to/components/');
* $helperPaths = array('/full/path/to/helpers/', '/next/full/path/to/helpers/');
* $vendorPaths = array('/full/path/to/vendors/', '/next/full/path/to/vendors/');
* $shellPaths = array('/full/path/to/shells/', '/next/full/path/to/shells/');
* $localePaths = array('/full/path/to/locale/', '/next/full/path/to/locale/';
* App::build(array(
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* '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
*

View file

@ -1,47 +1,51 @@
<?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
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @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
*/
/**
*
* 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.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
* $modelPaths = array('full path to models', 'second full path to models', 'etc...');
* $viewPaths = array('this path to views', 'second full path to views', 'etc...');
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
* App::build(array(
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* '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
*/
App::import('Core', array('Router', 'Controller'));
App::import('Core', 'Router');
App::import('Controller', 'Controller', false);
/**
* Dispatcher translates URLs to controller-action-paramter triads.
@ -692,7 +693,7 @@ class Dispatcher extends Object {
if (file_exists($filename)) {
if (!class_exists('View')) {
App::import('Core', 'View');
App::import('View', 'View', false);
}
$controller = null;
$view =& new View($controller, false);

View file

@ -25,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Configuration class (singleton). Used for managing runtime configuration information.
*
@ -43,14 +44,6 @@ class Configure extends Object {
*/
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.
*
@ -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['libs'][] = $libs;
$paths['models'][] = $libs . 'model' . DS;
$paths['datasources'][] = $libs . 'model' . DS . 'datasources' . DS;
$paths['behaviors'][] = $libs . 'model' . DS . 'behaviors' . DS;
$paths['controllers'][] = $libs . 'controller' . DS;
$paths['components'][] = $libs . 'controller' . DS . 'components' . DS;
@ -764,7 +747,7 @@ class App extends Object {
$_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;
if (!isset($types[$type])) {
@ -792,13 +775,13 @@ class App extends Object {
$objects[$key] = Inflector::camelize($value);
}
}
if ($cache === true && !empty($objects)) {
$_this->__objects[$name] = $objects;
if ($cache === true) {
$_this->__cache = true;
} else {
return $objects;
}
$_this->__objects[$name] = $objects;
}
return $_this->__objects[$name];
}
@ -984,12 +967,14 @@ class App extends Object {
}
continue;
}
if (!isset($this->__paths[$path])) {
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
}
$Folder =& new Folder();
$directories = $Folder->tree($path, false, 'dir');
$directories = $Folder->tree($path, array('.svn', 'tests', 'templates'), 'dir');
sort($directories);
$this->__paths[$path] = $directories;
}
@ -1103,7 +1088,7 @@ class App extends Object {
switch ($load) {
case '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')) {
App::import($type, 'AppModel', false, App::path('models'));
@ -1173,22 +1158,15 @@ class App extends Object {
*/
function __paths($type) {
$type = strtolower($type);
if ($type === 'core') {
$path = App::core();
$paths = array();
foreach ($path as $key => $value) {
$count = count($key);
for ($i = 0; $i < $count; $i++) {
$paths[] = $path[$key][$i];
}
}
return $paths;
if ($type === 'core') {
return App::core('libs');
}
if ($paths = App::path($type .'s')) {
return $paths;
}
return $paths;
}
/**
@ -1255,6 +1233,7 @@ class App extends Object {
unset($this->__paths[rtrim($core[0], DS)]);
Cache::write('dir_map', array_filter($this->__paths), '_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$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Multibyte');
/**
* EmailComponent
@ -36,7 +37,6 @@
* @subpackage cake.cake.libs.controller.components
*
*/
App::import('Core', 'Multibyte');
class EmailComponent extends Object{
/**

View file

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

View file

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

View file

@ -24,8 +24,9 @@
* Included libs
*/
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.

View file

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

View file

@ -26,7 +26,7 @@
* @lastmodified $Date$
* @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.

View file

@ -27,7 +27,8 @@
/**
* 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 file

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

View file

@ -23,7 +23,7 @@
* @lastmodified $Date$
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -23,7 +23,7 @@
* @lastmodified $Date$
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -18,7 +18,7 @@
* @since CakePHP(tm) v 1.3
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -25,7 +25,9 @@
* @lastmodified $Date$
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);
@ -350,7 +352,7 @@ class ShellTest extends CakeTestCase {
* @access public
*/
function testCreateFileWindows() {
$this->skipUnless(DIRECTORY_SEPARATOR === '\\', '%s Supported on Windows only');
$this->skipUnless(DIRECTORY_SEPARATOR === '\\', 'testCreateFileWindows supported on Windows only');
$path = TMP . 'shell_test';
$file = $path . DS . 'file1.php';

View file

@ -17,7 +17,9 @@
* @since CakePHP(tm) v 1.3
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -17,7 +17,7 @@
* @since CakePHP(tm) v 1.3
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);
@ -73,7 +73,6 @@ class TEST_DATABASE_CONFIG {
* @subpackage cake.tests.cases.console.libs.tasks
*/
class DbConfigTaskTest extends CakeTestCase {
/**
* startTest method
*
@ -89,7 +88,6 @@ class DbConfigTaskTest extends CakeTestCase {
$this->Task->params['working'] = rtrim(APP, '/');
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
}
/**
* endTest method
*
@ -100,7 +98,6 @@ class DbConfigTaskTest extends CakeTestCase {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
/**
* Test the getConfig method.
*
@ -111,7 +108,6 @@ class DbConfigTaskTest extends CakeTestCase {
$result = $this->Task->getConfig();
$this->assertEqual($result, 'otherOne');
}
/**
* test that initialize sets the path up.
*
@ -124,7 +120,6 @@ class DbConfigTaskTest extends CakeTestCase {
$this->assertEqual($this->Task->path, APP . 'config' . DS);
}
/**
* test execute and by extension __interactive
*

View file

@ -25,7 +25,8 @@
* @lastmodified $Date$
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -17,7 +17,7 @@
* @since CakePHP(tm) v 1.3
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);
@ -47,7 +47,6 @@ Mock::generatePartial(
'Shell', 'MockFixtureModelTask',
array('in', 'out', 'err', 'createFile', '_stop', 'getName', 'getTable', 'listAll')
);
/**
* FixtureTaskTest class
*
@ -55,14 +54,12 @@ Mock::generatePartial(
* @subpackage cake.tests.cases.console.libs.tasks
*/
class FixtureTaskTest extends CakeTestCase {
/**
* fixtures
*
* @var array
**/
var $fixtures = array('core.article', 'core.comment');
/**
* startTest method
*
@ -78,7 +75,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->Dispatch->shellPaths = App::path('shells');
$this->Task->Template->initialize();
}
/**
* endTest method
*
@ -89,7 +85,6 @@ class FixtureTaskTest extends CakeTestCase {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
/**
* test that initialize sets the path
*
@ -102,7 +97,6 @@ class FixtureTaskTest extends CakeTestCase {
$expected = '/my/path/tests/fixtures/';
$this->assertEqual($Task->path, $expected);
}
/**
* test import option array generation
*
@ -131,7 +125,6 @@ class FixtureTaskTest extends CakeTestCase {
$expected = array('fromTable' => true);
$this->assertEqual($result, $expected);
}
/**
* 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('/Third Article/', $result, 'Missing import data %s');
}
/**
* 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->execute();
}
/**
* 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->execute();
}
/**
* test interactive mode of execute
*
@ -202,7 +192,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
$this->Task->execute();
}
/**
* Test that bake works
*
@ -236,7 +225,6 @@ class FixtureTaskTest extends CakeTestCase {
$this->assertNoPattern('/var \$fields/', $result);
$this->assertNoPattern('/var \$records/', $result);
}
/**
* 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')));
$result = $this->Task->generateFixtureFile('Article', array());
}
/**
* test generating files into plugins.
*

View file

@ -20,7 +20,7 @@
* @since CakePHP v 1.3
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -22,7 +22,7 @@
* @since CakePHP v 1.3.0
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -20,7 +20,7 @@
* @since CakePHP v 1.3.0
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -20,7 +20,7 @@
* @since CakePHP(tm) v 1.3
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -1,6 +1,5 @@
<?php
/* SVN FILE: $Id$ */
/**
* TestTaskTest file
*
@ -22,8 +21,9 @@
* @since CakePHP v 1.2.0.7726
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Shell');
App::import('Core', array('Controller', 'Model'));
App::import('Shell', 'Shell', false);
App::import('Controller', 'Controller', false);
App::import('Model', 'Model', false);
if (!defined('DISABLE_AUTO_DISPATCH')) {
define('DISABLE_AUTO_DISPATCH', true);
@ -92,7 +92,6 @@ class TestTaskTag extends Model {
)
);
}
/**
* Simulated Plugin
**/
@ -124,7 +123,6 @@ class TestTaskCommentsController extends Controller {
class TestTaskTest extends CakeTestCase {
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/**
* startTest method
*
@ -138,7 +136,6 @@ class TestTaskTest extends CakeTestCase {
$this->Task->Dispatch =& $this->Dispatcher;
$this->Task->Template =& new TemplateTask($this->Dispatcher);
}
/**
* endTest method
*
@ -148,7 +145,6 @@ class TestTaskTest extends CakeTestCase {
function endTest() {
ClassRegistry::flush();
}
/**
* Test that file path generation doesn't continuously append paths.
*
@ -172,7 +168,6 @@ class TestTaskTest extends CakeTestCase {
$this->Task->expectAt(2, 'createFile', array($file, '*'));
$this->Task->bake('Controller', 'Comments');
}
/**
* Test that method introspection pulls all relevant non parent class
* methods into the test case.
@ -184,7 +179,6 @@ class TestTaskTest extends CakeTestCase {
$expected = array('doSomething', 'doSomethingElse');
$this->assertEqual($result, $expected);
}
/**
* test that the generation of fixtures works correctly.
*
@ -198,7 +192,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertEqual(sort($result), sort($expected));
}
/**
* test that the generation of fixtures works correctly.
*
@ -212,7 +205,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertEqual(sort($result), sort($expected));
}
/**
* test user interaction to get object type
*
@ -227,7 +219,6 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getObjectType();
$this->assertEqual($result, $this->Task->classTypes[1]);
}
/**
* creating test subjects should clear the registry so the registry is always fresh
*
@ -251,7 +242,6 @@ class TestTaskTest extends CakeTestCase {
$keys = ClassRegistry::keys();
$this->assertFalse(in_array('random', $keys));
}
/**
* test that getClassName returns the user choice as a classname.
*
@ -272,7 +262,6 @@ class TestTaskTest extends CakeTestCase {
$options = Configure::listObjects('model');
$this->assertEqual($result, $options[0]);
}
/**
* 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');
$this->assertEqual($result, $expected);
}
/**
* test that resolving classnames works
*
@ -307,7 +295,6 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->getRealClassname('Component', 'Auth');
$this->assertEqual($result, 'AuthComponent');
}
/**
* test baking files.
*
@ -336,7 +323,6 @@ class TestTaskTest extends CakeTestCase {
$this->assertPattern("/'app\.test_task_tag'/", $result);
$this->assertPattern("/'app\.articles_tag'/", $result);
}
/**
* 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\.articles_tag'/", $result);
}
/**
* test Constructor generation ensure that constructClasses is called for controllers
*
@ -385,7 +370,6 @@ class TestTaskTest extends CakeTestCase {
$expected = "new FormHelper()\n";
$this->assertEqual($result, $expected);
}
/**
* Test that mock class generation works for the appropriate classes
*
@ -395,7 +379,6 @@ class TestTaskTest extends CakeTestCase {
$result = $this->Task->hasMockClass('controller');
$this->assertTrue($result);
}
/**
* test bake() with a -plugin param
*
@ -408,7 +391,6 @@ class TestTaskTest extends CakeTestCase {
$this->Task->expectAt(0, 'createFile', array($path, '*'));
$this->Task->bake('Helper', 'Form');
}
/**
* 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';
$this->assertEqual($result, $expected);
}
/**
* 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->execute();
}
/**
* test execute with type and class name defined
*

View file

@ -20,7 +20,7 @@
* @since CakePHP v 1.2.0.7726
* @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')) {
define('DISABLE_AUTO_DISPATCH', true);

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$
* @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

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$
* @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 . 'cake_reporter.php';

View file

@ -131,13 +131,11 @@ class ConfigureTest extends CakeTestCase {
$result = Configure::read('Key.One');
$this->assertEqual($expected['One'], $result);
$result = Configure::read('Key.One.Two');
$this->assertEqual($expected['One']['Two'], $result);
$result = Configure::read('Key.One.Two.Three.Four.Five');
$this->assertEqual('cool', $result);
}
/**
@ -385,7 +383,16 @@ class AppImportTest extends UnitTestCase {
$file = App::import();
$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);
$file = App::import('Model', 'SomeRandomModelThatDoesNotExist', false);

View file

@ -25,7 +25,8 @@
* @lastmodified $Date$
* @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')) {

View file

@ -25,8 +25,8 @@
* @lastmodified $Date$
* @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
*

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$
* @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'));
Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop'));

View file

@ -25,7 +25,7 @@
* @lastmodified $Date$
* @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');
/**

View file

@ -19,7 +19,7 @@
* @since CakePHP(tm) v 1.2.0.5436
* @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', 'Cookie');

View file

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

View file

@ -42,10 +42,12 @@ class I18nTest extends CakeTestCase {
* @return void
*/
function setUp() {
Cache::delete('object_map', '_cake_core_');
App::build(array(
'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')
));
), true);
App::objects('plugin', null, false);
}
/**
@ -55,7 +57,9 @@ class I18nTest extends CakeTestCase {
* @return void
*/
function tearDown() {
Cache::delete('object_map', '_cake_core_');
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);
$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
*

View file

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