Renaming Dispatcher::__loadRoutes -> Dispatcher::_loadRoutes to match naming conventions.

Updating method name usage, as assertType is deprecated as of PHPUnit 3.5.6
This commit is contained in:
mark_story 2010-12-24 12:54:04 -05:00
parent 8eaba29c3f
commit e20ea8ad72
20 changed files with 64 additions and 67 deletions

View file

@ -198,7 +198,7 @@ class Dispatcher {
if (count(Router::$routes) == 0) {
$namedExpressions = Router::getNamedExpressions();
extract($namedExpressions);
$this->__loadRoutes();
$this->_loadRoutes();
}
$params = Router::parse($request->url);
@ -254,9 +254,8 @@ class Dispatcher {
* Loads route configuration
*
* @return void
* @access protected
*/
protected function __loadRoutes() {
protected function _loadRoutes() {
include CONFIGS . 'routes.php';
}

View file

@ -435,6 +435,6 @@ TEXT;
$formatter = new HelpFormatter($parser);
$result = $formatter->xml(false);
$this->assertType('SimpleXmlElement', $result);
$this->assertInstanceOf('SimpleXmlElement', $result);
}
}

View file

@ -49,8 +49,8 @@ class TaskCollectionTest extends CakeTestCase {
*/
function testLoad() {
$result = $this->Tasks->load('DbConfig');
$this->assertType('DbConfigTask', $result);
$this->assertType('DbConfigTask', $this->Tasks->DbConfig);
$this->assertInstanceOf('DbConfigTask', $result);
$this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig);
$result = $this->Tasks->attached();
$this->assertEquals(array('DbConfig'), $result, 'attached() results are wrong.');
@ -65,8 +65,8 @@ class TaskCollectionTest extends CakeTestCase {
*/
function testLoadWithEnableFalse() {
$result = $this->Tasks->load('DbConfig', array(), false);
$this->assertType('DbConfigTask', $result);
$this->assertType('DbConfigTask', $this->Tasks->DbConfig);
$this->assertInstanceOf('DbConfigTask', $result);
$this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig);
$this->assertFalse($this->Tasks->enabled('DbConfig'), 'DbConfigTask should be disabled');
}
@ -94,8 +94,8 @@ class TaskCollectionTest extends CakeTestCase {
$this->Tasks = new TaskCollection($shell, $dispatcher);
$result = $this->Tasks->load('TestPlugin.OtherTask');
$this->assertType('OtherTaskTask', $result, 'Task class is wrong.');
$this->assertType('OtherTaskTask', $this->Tasks->OtherTask, 'Class is wrong');
$this->assertInstanceOf('OtherTaskTask', $result, 'Task class is wrong.');
$this->assertInstanceOf('OtherTaskTask', $this->Tasks->OtherTask, 'Class is wrong');
}
/**

View file

@ -143,9 +143,9 @@ class ShellTest extends CakeTestCase {
*/
public function testConstruct() {
$this->assertEqual($this->Shell->name, 'ShellTestShell');
$this->assertType('ConsoleInput', $this->Shell->stdin);
$this->assertType('ConsoleOutput', $this->Shell->stdout);
$this->assertType('ConsoleOutput', $this->Shell->stderr);
$this->assertInstanceOf('ConsoleInput', $this->Shell->stdin);
$this->assertInstanceOf('ConsoleOutput', $this->Shell->stdout);
$this->assertInstanceOf('ConsoleOutput', $this->Shell->stderr);
}
/**

View file

@ -284,7 +284,7 @@ class ComponentTest extends CakeTestCase {
$Collection = new ComponentCollection();
$Component = new AppleComponent($Collection);
$this->assertType('OrangeComponent', $Component->Orange, 'class is wrong');
$this->assertInstanceOf('OrangeComponent', $Component->Orange, 'class is wrong');
}
/**
@ -296,8 +296,8 @@ class ComponentTest extends CakeTestCase {
$Collection = new ComponentCollection();
$Apple = new AppleComponent($Collection);
$this->assertType('OrangeComponent', $Apple->Orange, 'class is wrong');
$this->assertType('BananaComponent', $Apple->Orange->Banana, 'class is wrong');
$this->assertInstanceOf('OrangeComponent', $Apple->Orange, 'class is wrong');
$this->assertInstanceOf('BananaComponent', $Apple->Orange->Banana, 'class is wrong');
$this->assertTrue(empty($Apple->Session));
$this->assertTrue(empty($Apple->Orange->Session));
}
@ -311,7 +311,7 @@ class ComponentTest extends CakeTestCase {
$Collection = new ComponentCollection();
$Apple = $Collection->load('Apple');
$this->assertType('OrangeComponent', $Apple->Orange, 'class is wrong');
$this->assertInstanceOf('OrangeComponent', $Apple->Orange, 'class is wrong');
$result = $Collection->enabled();
$this->assertEquals(array('Apple'), $result, 'Too many components enabled.');
}
@ -346,9 +346,9 @@ class ComponentTest extends CakeTestCase {
$Controller->beforeFilter();
$Controller->Components->trigger('startup', array(&$Controller));
$this->assertType('SomethingWithEmailComponent', $Controller->SomethingWithEmail);
$this->assertType('EmailComponent', $Controller->SomethingWithEmail->Email);
$this->assertType('ComponentTestController', $Controller->SomethingWithEmail->Email->Controller);
$this->assertInstanceOf('SomethingWithEmailComponent', $Controller->SomethingWithEmail);
$this->assertInstanceOf('EmailComponent', $Controller->SomethingWithEmail->Email);
$this->assertInstanceOf('ComponentTestController', $Controller->SomethingWithEmail->Email->Controller);
}
}

View file

@ -47,8 +47,8 @@ class ComponentCollectionTest extends CakeTestCase {
*/
function testLoad() {
$result = $this->Components->load('Cookie');
$this->assertType('CookieComponent', $result);
$this->assertType('CookieComponent', $this->Components->Cookie);
$this->assertInstanceOf('CookieComponent', $result);
$this->assertInstanceOf('CookieComponent', $this->Components->Cookie);
$result = $this->Components->attached();
$this->assertEquals(array('Cookie'), $result, 'attached() results are wrong.');
@ -66,8 +66,8 @@ class ComponentCollectionTest extends CakeTestCase {
*/
function testLoadWithEnableFalse() {
$result = $this->Components->load('Cookie', array('enabled' => false));
$this->assertType('CookieComponent', $result);
$this->assertType('CookieComponent', $this->Components->Cookie);
$this->assertInstanceOf('CookieComponent', $result);
$this->assertInstanceOf('CookieComponent', $this->Components->Cookie);
$this->assertFalse($this->Components->enabled('Cookie'), 'Cookie should be disabled');
}
@ -91,8 +91,8 @@ class ComponentCollectionTest extends CakeTestCase {
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
));
$result = $this->Components->load('TestPlugin.OtherComponent');
$this->assertType('OtherComponentComponent', $result, 'Component class is wrong.');
$this->assertType('OtherComponentComponent', $this->Components->OtherComponent, 'Class is wrong');
$this->assertInstanceOf('OtherComponentComponent', $result, 'Component class is wrong.');
$this->assertInstanceOf('OtherComponentComponent', $this->Components->OtherComponent, 'Class is wrong');
App::build();
}

View file

@ -462,7 +462,7 @@ class ControllerTest extends CakeTestCase {
$result = $Controller->loadModel('Comment');
$this->assertTrue($result);
$this->assertType('Comment', $Controller->Comment);
$this->assertInstanceOf('Comment', $Controller->Comment);
$this->assertTrue(in_array('Comment', $Controller->modelNames));
ClassRegistry::flush();
@ -1248,8 +1248,8 @@ class ControllerTest extends CakeTestCase {
$Controller = new TestController($request);
$Controller->constructClasses();
$this->assertType('SecurityComponent', $Controller->Security);
$this->assertType('ControllerComment', $Controller->ControllerComment);
$this->assertInstanceOf('SecurityComponent', $Controller->Security);
$this->assertInstanceOf('ControllerComment', $Controller->ControllerComment);
}
/**

View file

@ -171,7 +171,7 @@ class ControllerTestCaseTest extends CakeTestCase {
)
));
$this->assertNull($Posts->Post->save(array()));
$this->assertIsA($Posts->Post->find('all'), 'array');
$this->assertInternalType('array', $Posts->Post->find('all'));
$Posts = $this->Case->generate('Posts', array(
'models' => array('Post'),
@ -198,7 +198,7 @@ class ControllerTestCaseTest extends CakeTestCase {
function testTestAction() {
$Controller = $this->Case->generate('TestsApps');
$this->Case->testAction('/tests_apps/index');
$this->assertIsA($this->Case->controller->viewVars, 'array');
$this->assertInternalType('array', $this->Case->controller->viewVars);
$this->Case->testAction('/tests_apps/set_action');
$results = $this->Case->controller->viewVars;
@ -254,8 +254,7 @@ class ControllerTestCaseTest extends CakeTestCase {
include TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'config' . DS . 'routes.php';
$this->Case->loadRoutes = false;
$result = $this->Case->testAction('/tests_apps/index.json', array('return' => 'view'));
$result = $this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view'));
}
/**

View file

@ -232,7 +232,6 @@ class DebuggerTest extends CakeTestCase {
View::$viewVars = array
View::$layout = "default"
View::$layoutPath = NULL
View::$autoRender = true
View::$autoLayout = true
View::$ext = ".ctp"
View::$subDir = NULL
@ -250,8 +249,9 @@ class DebuggerTest extends CakeTestCase {
View::$output = false
View::$request = NULL
View::$elementCache = "default"';
$result = str_replace(array("\t", "\r\n", "\n"), "", strtolower($result));
$expected = str_replace(array("\t", "\r\n", "\n"), "", strtolower($expected));
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
$this->assertEqual($result, $expected);
}

View file

@ -265,7 +265,7 @@ class ExceptionRendererTest extends CakeTestCase {
$exception = new NotFoundException('Page not found');
$ExceptionRenderer = new ExceptionRenderer($exception);
$this->assertType('CakeErrorController', $ExceptionRenderer->controller);
$this->assertInstanceOf('CakeErrorController', $ExceptionRenderer->controller);
$this->assertEquals('error400', $ExceptionRenderer->method);
$this->assertEquals($exception, $ExceptionRenderer->error);
}
@ -280,7 +280,7 @@ class ExceptionRendererTest extends CakeTestCase {
$exception = new MissingActionException('Page not found');
$ExceptionRenderer = new ExceptionRenderer($exception);
$this->assertType('CakeErrorController', $ExceptionRenderer->controller);
$this->assertInstanceOf('CakeErrorController', $ExceptionRenderer->controller);
$this->assertEquals('error400', $ExceptionRenderer->method);
$this->assertEquals($exception, $ExceptionRenderer->error);
}

View file

@ -61,27 +61,27 @@ class ModelIntegrationTest extends BaseModelTest {
$Article = new ArticleFeatured();
$this->assertTrue(isset($Article->belongsTo['User']));
$this->assertFalse(property_exists($Article, 'User'));
$this->assertType('User', $Article->User);
$this->assertInstanceOf('User', $Article->User);
$this->assertTrue(isset($Article->belongsTo['Category']));
$this->assertFalse(property_exists($Article, 'Category'));
$this->assertTrue(isset($Article->Category));
$this->assertType('Category', $Article->Category);
$this->assertInstanceOf('Category', $Article->Category);
$this->assertTrue(isset($Article->hasMany['Comment']));
$this->assertFalse(property_exists($Article, 'Comment'));
$this->assertTrue(isset($Article->Comment));
$this->assertType('Comment', $Article->Comment);
$this->assertInstanceOf('Comment', $Article->Comment);
$this->assertTrue(isset($Article->hasAndBelongsToMany['Tag']));
//There was not enough information to setup the association (joinTable and associationForeignKey)
//so the model was not lazy loaded
$this->assertTrue(property_exists($Article, 'Tag'));
$this->assertTrue(isset($Article->Tag));
$this->assertType('Tag', $Article->Tag);
$this->assertInstanceOf('Tag', $Article->Tag);
$this->assertFalse(property_exists($Article, 'ArticleFeaturedsTag'));
$this->assertType('AppModel', $Article->ArticleFeaturedsTag);
$this->assertInstanceOf('AppModel', $Article->ArticleFeaturedsTag);
$this->assertEquals($Article->hasAndBelongsToMany['Tag']['joinTable'], 'article_featureds_tags');
$this->assertEquals($Article->hasAndBelongsToMany['Tag']['associationForeignKey'], 'tag_id');
}
@ -97,10 +97,10 @@ class ModelIntegrationTest extends BaseModelTest {
$Article = new ArticleB();
$this->assertTrue(isset($Article->hasAndBelongsToMany['TagB']));
$this->assertFalse(property_exists($Article, 'TagB'));
$this->assertType('TagB', $Article->TagB);
$this->assertInstanceOf('TagB', $Article->TagB);
$this->assertFalse(property_exists($Article, 'ArticlesTag'));
$this->assertType('AppModel', $Article->ArticlesTag);
$this->assertInstanceOf('AppModel', $Article->ArticlesTag);
$UuidTag = new UuidTag();
$this->assertTrue(isset($UuidTag->hasAndBelongsToMany['Fruit']));
@ -110,7 +110,7 @@ class ModelIntegrationTest extends BaseModelTest {
$this->assertFalse(property_exists($UuidTag, 'FruitsUuidTag'));
$this->assertTrue(isset($UuidTag->FruitsUuidTag));
$this->assertType('FruitsUuidTag', $UuidTag->FruitsUuidTag);
$this->assertInstanceOf('FruitsUuidTag', $UuidTag->FruitsUuidTag);
}
/**
@ -129,7 +129,7 @@ class ModelIntegrationTest extends BaseModelTest {
$Article->bindModel(array('belongsTo' => array('User')));
$this->assertTrue(isset($Article->belongsTo['User']));
$this->assertFalse(property_exists($Article, 'User'));
$this->assertType('User', $Article->User);
$this->assertInstanceOf('User', $Article->User);
}
/**

View file

@ -98,8 +98,8 @@ class ObjectCollectionTest extends CakeTestCase {
*/
function testLoad() {
$result = $this->Objects->load('First');
$this->assertType('FirstGenericObject', $result);
$this->assertType('FirstGenericObject', $this->Objects->First);
$this->assertInstanceOf('FirstGenericObject', $result);
$this->assertInstanceOf('FirstGenericObject', $this->Objects->First);
$result = $this->Objects->attached();
$this->assertEquals(array('First'), $result, 'attached() results are wrong.');

View file

@ -96,7 +96,7 @@ class DatabaseSessionTest extends CakeTestCase {
$storage = new DatabaseSession();
$session = ClassRegistry::getObject('session');
$this->assertType('SessionTestModel', $session);
$this->assertInstanceOf('SessionTestModel', $session);
$this->assertEquals('Session', $session->alias);
$this->assertEquals('test', $session->useDbConfig);
}

View file

@ -106,7 +106,7 @@ class TestManagerTest extends CakeTestCase {
$file = 'libs/test_manager.test.php';
$result = $this->TestManager->runTestCase($file, $this->Reporter, true);
$this->assertEquals(1, $this->_countFiles);
$this->assertType('PHPUnit_Framework_TestResult', $result);
$this->assertInstanceOf('PHPUnit_Framework_TestResult', $result);
}
}

View file

@ -858,8 +858,8 @@ class HelperTest extends CakeTestCase {
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
));
$Helper = new TestHelper($this->View);
$this->assertType('OtherHelperHelper', $Helper->OtherHelper);
$this->assertType('HtmlHelper', $Helper->Html);
$this->assertInstanceOf('OtherHelperHelper', $Helper->OtherHelper);
$this->assertInstanceOf('HtmlHelper', $Helper->Html);
App::build();
}

View file

@ -48,8 +48,8 @@ class HelperCollectionTest extends CakeTestCase {
*/
function testLoad() {
$result = $this->Helpers->load('Html');
$this->assertType('HtmlHelper', $result);
$this->assertType('HtmlHelper', $this->Helpers->Html);
$this->assertInstanceOf('HtmlHelper', $result);
$this->assertInstanceOf('HtmlHelper', $this->Helpers->Html);
$result = $this->Helpers->attached();
$this->assertEquals(array('Html'), $result, 'attached() results are wrong.');
@ -64,8 +64,8 @@ class HelperCollectionTest extends CakeTestCase {
*/
function testLoadWithEnabledFalse() {
$result = $this->Helpers->load('Html', array('enabled' => false));
$this->assertType('HtmlHelper', $result);
$this->assertType('HtmlHelper', $this->Helpers->Html);
$this->assertInstanceOf('HtmlHelper', $result);
$this->assertInstanceOf('HtmlHelper', $this->Helpers->Html);
$this->assertFalse($this->Helpers->enabled('Html'), 'Html should be disabled');
}
@ -90,8 +90,8 @@ class HelperCollectionTest extends CakeTestCase {
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
));
$result = $this->Helpers->load('TestPlugin.OtherHelper');
$this->assertType('OtherHelperHelper', $result, 'Helper class is wrong.');
$this->assertType('OtherHelperHelper', $this->Helpers->OtherHelper, 'Class is wrong');
$this->assertInstanceOf('OtherHelperHelper', $result, 'Helper class is wrong.');
$this->assertInstanceOf('OtherHelperHelper', $this->Helpers->OtherHelper, 'Class is wrong');
App::build();
}

View file

@ -546,7 +546,7 @@ class ViewTest extends CakeTestCase {
function test__get() {
$View = new View($this->PostsController);
$View->loadHelper('Html');
$this->assertType('HtmlHelper', $View->Html);
$this->assertInstanceOf('HtmlHelper', $View->Html);
}
/**
@ -561,8 +561,8 @@ class ViewTest extends CakeTestCase {
$View->helpers = array('Html', 'Form');
$View->loadHelpers();
$this->assertType('HtmlHelper', $View->Html, 'Object type is wrong.');
$this->assertType('FormHelper', $View->Form, 'Object type is wrong.');
$this->assertInstanceOf('HtmlHelper', $View->Html, 'Object type is wrong.');
$this->assertInstanceOf('FormHelper', $View->Form, 'Object type is wrong.');
}
/**

View file

@ -22,7 +22,7 @@ class FixturizedTestCase extends CakeTestCase {
* @return void
*/
public function testFixturePresent() {
$this->assertType('CakeFixtureManager', $this->fixtureManager);
$this->assertInstanceOf('CakeFixtureManager', $this->fixtureManager);
}
/**

View file

@ -494,7 +494,7 @@ class CakeTestCase extends PHPUnit_Framework_TestCase {
* @return void
*/
protected function assertIsA($object, $type, $message = '') {
return $this->assertType($type, $object, $message);
return $this->assertInstanceOf($type, $object, $message);
}
/**

View file

@ -65,10 +65,9 @@ class ControllerTestDispatcher extends Dispatcher {
* Loads routes and resets if the test case dictates it should
*
* @return void
* @access private
*/
protected function __loadRoutes() {
parent::__loadRoutes();
protected function _loadRoutes() {
parent::_loadRoutes();
if (!$this->loadRoutes) {
Router::reload();
}