Skip to content

Commit

Permalink
MINOR Fixing assertType() assertions with assertInstanceOf()
Browse files Browse the repository at this point in the history
  • Loading branch information
halkyon committed May 9, 2012
1 parent dedb9d0 commit c72bae3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/controller/CMSMainTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function testDraftDeletedPageCanBeOpenedInCMS() {
$response = $this->get('admin/cms/getitem?ID=' . $pageID . '&ajax=1'); $response = $this->get('admin/cms/getitem?ID=' . $pageID . '&ajax=1');


$livePage = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID"); $livePage = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID");
$this->assertType('SiteTree', $livePage); $this->assertInstanceOf('SiteTree', $livePage);
$this->assertTrue($livePage->canDelete()); $this->assertTrue($livePage->canDelete());


// Check that the 'restore' button exists as a simple way of checking that the correct page is returned. // Check that the 'restore' button exists as a simple way of checking that the correct page is returned.
Expand All @@ -175,12 +175,12 @@ function testGetRecord() {
$this->assertNull($cmsMain->getRecord('asdf')); $this->assertNull($cmsMain->getRecord('asdf'));


// Pages that are on draft and aren't on draft should both work // Pages that are on draft and aren't on draft should both work
$this->assertType('Page', $cmsMain->getRecord($page1ID)); $this->assertInstanceOf('Page', $cmsMain->getRecord($page1ID));
$this->assertType('Page', $cmsMain->getRecord($this->idFromFixture('Page','page2'))); $this->assertInstanceOf('Page', $cmsMain->getRecord($this->idFromFixture('Page','page2')));


// This functionality isn't actually used any more. // This functionality isn't actually used any more.
$newPage = $cmsMain->getRecord('new-Page-5'); $newPage = $cmsMain->getRecord('new-Page-5');
$this->assertType('Page', $newPage); $this->assertInstanceOf('Page', $newPage);
$this->assertEquals('5', $newPage->ParentID); $this->assertEquals('5', $newPage->ParentID);


} }
Expand Down
4 changes: 2 additions & 2 deletions tests/model/SiteTreeActionsTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function testActionsNoDeletePublishedRecord() {


// Get the live version of the page // Get the live version of the page
$page = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID"); $page = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID");
$this->assertType("SiteTree", $page); $this->assertInstanceOf("SiteTree", $page);


// Check that someone without the right permission can't delete the page // Check that someone without the right permission can't delete the page
$editor = $this->objFromFixture('Member', 'cmsnodeleteeditor'); $editor = $this->objFromFixture('Member', 'cmsnodeleteeditor');
Expand Down Expand Up @@ -116,7 +116,7 @@ function testActionsDeletedFromStageRecord() {


// Get the live version of the page // Get the live version of the page
$page = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID"); $page = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID");
$this->assertType('SiteTree', $page); $this->assertInstanceOf('SiteTree', $page);


$actions = $page->getCMSActions(); $actions = $page->getCMSActions();


Expand Down
4 changes: 2 additions & 2 deletions tests/model/SiteTreeTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function testParentNodeCachedInMemory() {
$child->Title = 'Page Title'; $child->Title = 'Page Title';
$child->setParent($parent); $child->setParent($parent);


$this->assertType("SiteTree", $child->Parent); $this->assertInstanceOf("SiteTree", $child->Parent);
$this->assertEquals("Section Title", $child->Parent->Title); $this->assertEquals("Section Title", $child->Parent->Title);
} }


Expand All @@ -166,7 +166,7 @@ function testParentModelReturnType() {
$child = new SiteTreeTest_PageNode(); $child = new SiteTreeTest_PageNode();


$child->setParent($parent); $child->setParent($parent);
$this->assertType('SiteTreeTest_PageNode', $child->Parent); $this->assertInstanceOf('SiteTreeTest_PageNode', $child->Parent);
} }


/** /**
Expand Down

0 comments on commit c72bae3

Please sign in to comment.