From 9a1170cd2b54b7baf03b048a91cba6d2befbe9de Mon Sep 17 00:00:00 2001 From: Bryan Crowe Date: Tue, 24 Sep 2013 22:10:36 -0400 Subject: [PATCH] Replaced true asserations with instanceOf asserations in test cases --- .../Case/Console/Command/SchemaShellTest.php | 2 +- .../Test/Case/Controller/ControllerTest.php | 6 ++-- lib/Cake/Test/Case/Routing/RouterTest.php | 2 +- .../Test/Case/Utility/ClassRegistryTest.php | 30 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php index e702e4b16f8..512d9b1bf42 100644 --- a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php @@ -137,7 +137,7 @@ public function tearDown() { public function testStartup() { $this->Shell->startup(); $this->assertTrue(isset($this->Shell->Schema)); - $this->assertTrue($this->Shell->Schema instanceof CakeSchema); + $this->assertInstanceOf('CakeSchema', $this->Shell->Schema); $this->assertEquals(Inflector::camelize(Inflector::slug(APP_DIR)), $this->Shell->Schema->name); $this->assertEquals('schema.php', $this->Shell->Schema->file); diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index 63ed922d0b6..071a1f85e3b 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -482,8 +482,8 @@ public function testConstructClasses() { $Controller = new Controller($request); $Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->constructClasses(); - $this->assertTrue($Controller->ControllerPost instanceof ControllerPost); - $this->assertTrue($Controller->ControllerComment instanceof ControllerComment); + $this->assertInstanceOf('ControllerPost', $Controller->ControllerPost); + $this->assertInstanceOf('ControllerComment', $Controller->ControllerComment); $this->assertEquals('Comment', $Controller->ControllerComment->name); @@ -497,7 +497,7 @@ public function testConstructClasses() { $Controller->constructClasses(); $this->assertTrue(isset($Controller->TestPluginPost)); - $this->assertTrue($Controller->TestPluginPost instanceof TestPluginPost); + $this->assertInstanceOf('TestPluginPost', $Controller->TestPluginPost); } /** diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index f843bda0315..f5a84c2df32 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -2354,7 +2354,7 @@ public function testUsingCustomRouteClass() { array('controller' => 'posts', 'action' => 'view'), array('routeClass' => 'MockConnectedRoute', 'slug' => '[a-z_-]+') ); - $this->assertTrue($routes[0] instanceof MockConnectedRoute, 'Incorrect class used. %s'); + $this->assertInstanceOf('MockConnectedRoute', $routes[0], 'Incorrect class used. %s'); $expected = array('controller' => 'posts', 'action' => 'view', 'slug' => 'test'); $routes[0]->expects($this->any()) ->method('parse') diff --git a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php index df656f65292..7fa1ea81857 100644 --- a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php +++ b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php @@ -136,7 +136,7 @@ class ClassRegistryTest extends CakeTestCase { */ public function testAddModel() { $Tag = ClassRegistry::init('RegisterArticleTag'); - $this->assertTrue($Tag instanceof RegisterArticleTag); + $this->assertInstanceOf('RegisterArticleTag', $Tag); $TagCopy = ClassRegistry::isKeySet('RegisterArticleTag'); $this->assertTrue($TagCopy); @@ -145,11 +145,11 @@ public function testAddModel() { $TagCopy = ClassRegistry::getObject('RegisterArticleTag'); - $this->assertTrue($TagCopy instanceof RegisterArticleTag); + $this->assertInstanceOf('RegisterArticleTag', $TagCopy); $this->assertSame($Tag, $TagCopy); $NewTag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag')); - $this->assertTrue($Tag instanceof RegisterArticleTag); + $this->assertInstanceOf('RegisterArticleTag', $Tag); $NewTagCopy = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag')); @@ -166,17 +166,17 @@ public function testAddModel() { $this->assertTrue($TagCopy->name === 'SomeOtherName'); $User = ClassRegistry::init(array('class' => 'RegisterUser', 'alias' => 'User', 'table' => false)); - $this->assertTrue($User instanceof AppModel); + $this->assertInstanceOf('AppModel', $User); $UserCopy = ClassRegistry::init(array('class' => 'RegisterUser', 'alias' => 'User', 'table' => false)); - $this->assertTrue($UserCopy instanceof AppModel); + $this->assertInstanceOf('AppModel', $UserCopy); $this->assertEquals($User, $UserCopy); $Category = ClassRegistry::init(array('class' => 'RegisterCategory')); - $this->assertTrue($Category instanceof RegisterCategory); + $this->assertTrue('RegisterCategory', $Category); $ParentCategory = ClassRegistry::init(array('class' => 'RegisterCategory', 'alias' => 'ParentCategory')); - $this->assertTrue($ParentCategory instanceof RegisterCategory); + $this->assertInstanceOf('RegisterCategory', $ParentCategory); $this->assertNotSame($Category, $ParentCategory); $this->assertNotEquals($Category->alias, $ParentCategory->alias); @@ -193,12 +193,12 @@ public function testClassRegistryFlush() { ClassRegistry::init('RegisterArticleTag'); $ArticleTag = ClassRegistry::getObject('RegisterArticleTag'); - $this->assertTrue($ArticleTag instanceof RegisterArticleTag); + $this->assertInstanceOf('RegisterArticleTag', $ArticleTag); ClassRegistry::flush(); $NoArticleTag = ClassRegistry::isKeySet('RegisterArticleTag'); $this->assertFalse($NoArticleTag); - $this->assertTrue($ArticleTag instanceof RegisterArticleTag); + $this->assertTrue('RegisterArticleTag', $ArticleTag); } /** @@ -233,13 +233,13 @@ public function testAddMultipleModels() { $this->assertTrue($Tag); $Article = ClassRegistry::getObject('Article'); - $this->assertTrue($Article instanceof RegisterArticle); + $this->assertInstanceOf('RegisterArticle', $Article); $Featured = ClassRegistry::getObject('Featured'); - $this->assertTrue($Featured instanceof RegisterArticleFeatured); + $this->assertInstanceOf('RegisterArticleFeatured', $Featured); $Tag = ClassRegistry::getObject('Tag'); - $this->assertTrue($Tag instanceof RegisterArticleTag); + $this->assertInstanceOf('RegisterArticleTag', $Tag); } /** @@ -254,15 +254,15 @@ public function testPluginAppModel() { //Faking a plugin CakePlugin::load('RegistryPlugin', array('path' => '/fake/path')); $TestRegistryPluginModel = ClassRegistry::init('RegistryPlugin.TestRegistryPluginModel'); - $this->assertTrue($TestRegistryPluginModel instanceof TestRegistryPluginModel); + $this->assertInstanceOf('TestRegistryPluginModel', $TestRegistryPluginModel); $this->assertEquals('something_', $TestRegistryPluginModel->tablePrefix); $PluginUser = ClassRegistry::init(array('class' => 'RegistryPlugin.RegisterUser', 'alias' => 'RegistryPluginUser', 'table' => false)); - $this->assertTrue($PluginUser instanceof RegistryPluginAppModel); + $this->assertInstanceOf('RegistryPluginAppModel', $PluginUser); $PluginUserCopy = ClassRegistry::getObject('RegistryPluginUser'); - $this->assertTrue($PluginUserCopy instanceof RegistryPluginAppModel); + $this->assertInstanceOf('RegistryPluginAppModel', $PluginUserCopy); $this->assertSame($PluginUser, $PluginUserCopy); CakePlugin::unload(); }