Skip to content

Commit

Permalink
updating App::import usage. ran each test and everything seems ok.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwoo committed Jul 26, 2009
1 parent 0567de2 commit 61022f4
Show file tree
Hide file tree
Showing 37 changed files with 81 additions and 13,649 deletions.
5 changes: 3 additions & 2 deletions cake/dispatcher.php
Expand Up @@ -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.
Expand Down Expand Up @@ -692,7 +693,7 @@ function cached($url) {


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);
Expand Down
17 changes: 4 additions & 13 deletions cake/libs/configure.php
Expand Up @@ -777,11 +777,9 @@ function objects($type, $path = null, $cache = true) {
} }


if ($cache === true) { if ($cache === true) {
$_this->__objects[$name] = $objects;
$_this->__cache = true; $_this->__cache = true;
} else {
return $objects;
} }
$_this->__objects[$name] = $objects;
} }


return $_this->__objects[$name]; return $_this->__objects[$name];
Expand Down Expand Up @@ -976,6 +974,7 @@ function __find($file, $recursive = true) {
} }
$Folder =& new Folder(); $Folder =& new Folder();
$directories = $Folder->tree($path, array('.svn', 'tests', 'templates'), 'dir'); $directories = $Folder->tree($path, array('.svn', 'tests', 'templates'), 'dir');
sort($directories);
$this->__paths[$path] = $directories; $this->__paths[$path] = $directories;
} }


Expand Down Expand Up @@ -1089,7 +1088,7 @@ function __settings($type, $plugin, $parent) {
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'));
Expand Down Expand Up @@ -1162,15 +1161,7 @@ function __paths($type) {
$paths = array(); $paths = array();


if ($type === 'core') { if ($type === 'core') {
$path = App::core(); return App::core('libs');

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;
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/email.php
Expand Up @@ -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
Expand All @@ -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{


/** /**
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/controller/controller.php
Expand Up @@ -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
* *
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo/dbo_mysqli.php
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cake/libs/model/model.php
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/router.php
Expand Up @@ -31,7 +31,7 @@
* *
*/ */
if (!class_exists('Object')) { if (!class_exists('Object')) {
App::import('Core', 'Object'); require LIBS . 'object.php';
} }


/** /**
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/view/helpers/app_helper.php
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion cake/libs/view/view.php
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions cake/tests/cases/console/cake.test.php
Expand Up @@ -109,6 +109,16 @@ function stdout($string, $newline = true) {
} }
} }


/**
* clear method
*
* @access public
* @return void
*/
function clear() {

}

/** /**
* _stop method * _stop method
* *
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/console/libs/acl.test.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/console/libs/api.test.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/console/libs/bake.test.php
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions cake/tests/cases/console/libs/shell.test.php
Expand Up @@ -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);
Expand Down Expand Up @@ -350,7 +352,7 @@ function testCreateFile() {
* @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';
Expand Down
4 changes: 3 additions & 1 deletion cake/tests/cases/console/libs/tasks/controller.test.php
Expand Up @@ -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);
Expand Down
11 changes: 3 additions & 8 deletions cake/tests/cases/console/libs/tasks/db_config.test.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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
* *
Expand All @@ -89,7 +88,6 @@ function startTest() {
$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
* *
Expand All @@ -100,7 +98,6 @@ function endTest() {
unset($this->Task, $this->Dispatcher); unset($this->Task, $this->Dispatcher);
ClassRegistry::flush(); ClassRegistry::flush();
} }

/** /**
* Test the getConfig method. * Test the getConfig method.
* *
Expand All @@ -111,7 +108,6 @@ function testGetConfig() {
$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.
* *
Expand All @@ -122,9 +118,8 @@ function testInitialize() {
$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
* *
Expand Down
3 changes: 2 additions & 1 deletion cake/tests/cases/console/libs/tasks/extract.test.php
Expand Up @@ -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);
Expand Down

0 comments on commit 61022f4

Please sign in to comment.