Skip to content

Commit

Permalink
Revert "MINOR Replaced assertType() calls with assertInstanceOf(), de…
Browse files Browse the repository at this point in the history
…precated in PHPUnit 3.6 (throws warnings as of 3.5.10)" - causing too many issues in mixed build environments with other projects requiring PHPUnit 3.4

This reverts commit 7d609f2.
  • Loading branch information
chillu committed Mar 11, 2011
1 parent 4374bd8 commit a220d37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions tests/CMSMainTest.php
Expand Up @@ -150,7 +150,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->assertInstanceOf('SiteTree', $livePage); $this->assertType('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 @@ -174,12 +174,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->assertInstanceOf('Page', $cmsMain->getRecord($page1ID)); $this->assertType('Page', $cmsMain->getRecord($page1ID));
$this->assertInstanceOf('Page', $cmsMain->getRecord($this->idFromFixture('Page','page2'))); $this->assertType('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->assertInstanceOf('Page', $newPage); $this->assertType('Page', $newPage);
$this->assertEquals('5', $newPage->ParentID); $this->assertEquals('5', $newPage->ParentID);


} }
Expand Down
6 changes: 3 additions & 3 deletions tests/CMSMenuTest.php
Expand Up @@ -16,7 +16,7 @@ public function testBasicMenuHandling() {
CMSMenu::add_controller('CMSMain'); CMSMenu::add_controller('CMSMain');
$menuItems = CMSMenu::get_menu_items(); $menuItems = CMSMenu::get_menu_items();
$menuItem = $menuItems['CMSMain']; $menuItem = $menuItems['CMSMain'];
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem'); $this->assertType('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
$this->assertEquals($menuItem->url, singleton('CMSMain')->Link(), 'Controller menu item has the correct link'); $this->assertEquals($menuItem->url, singleton('CMSMain')->Link(), 'Controller menu item has the correct link');
$this->assertEquals($menuItem->controller, 'CMSMain', 'Controller menu item has the correct controller class'); $this->assertEquals($menuItem->controller, 'CMSMain', 'Controller menu item has the correct controller class');
$this->assertEquals($menuItem->priority, singleton('CMSMain')->stat('menu_priority'), 'Controller menu item has the correct priority'); $this->assertEquals($menuItem->priority, singleton('CMSMain')->stat('menu_priority'), 'Controller menu item has the correct priority');
Expand All @@ -26,7 +26,7 @@ public function testBasicMenuHandling() {
CMSMenu::add_link('LinkCode', 'link title', 'http://www.example.com'); CMSMenu::add_link('LinkCode', 'link title', 'http://www.example.com');
$menuItems = CMSMenu::get_menu_items(); $menuItems = CMSMenu::get_menu_items();
$menuItem = $menuItems['LinkCode']; $menuItem = $menuItems['LinkCode'];
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem'); $this->assertType('CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem');
$this->assertEquals($menuItem->title, 'link title', 'Link menu item has the correct title'); $this->assertEquals($menuItem->title, 'link title', 'Link menu item has the correct title');
$this->assertEquals($menuItem->url,'http://www.example.com', 'Link menu item has the correct link'); $this->assertEquals($menuItem->url,'http://www.example.com', 'Link menu item has the correct link');
$this->assertNull($menuItem->controller, 'Link menu item has no controller class'); $this->assertNull($menuItem->controller, 'Link menu item has no controller class');
Expand All @@ -53,7 +53,7 @@ public function testAdvancedMenuHandling() {
CMSMenu::clear_menu(); CMSMenu::clear_menu();
CMSMenu::populate_menu(); CMSMenu::populate_menu();
$menuItem = CMSMenu::get_menu_item('CMSMain'); $menuItem = CMSMenu::get_menu_item('CMSMain');
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'CMSMain menu item exists'); $this->assertType('CMSMenuItem', $menuItem, 'CMSMain menu item exists');
$this->assertEquals($menuItem->url, singleton('CMSMain')->Link(), 'Menu item has the correct link'); $this->assertEquals($menuItem->url, singleton('CMSMain')->Link(), 'Menu item has the correct link');
$this->assertEquals($menuItem->controller, 'CMSMain', 'Menu item has the correct controller class'); $this->assertEquals($menuItem->controller, 'CMSMain', 'Menu item has the correct controller class');
$this->assertEquals( $this->assertEquals(
Expand Down
2 changes: 1 addition & 1 deletion tests/LeftAndMainTest.php
Expand Up @@ -49,7 +49,7 @@ public function testLeftAndMainSubclasses() {


$response = $this->get($link); $response = $this->get($link);


$this->assertInstanceOf('SS_HTTPResponse', $response, "$link should return a response object"); $this->assertType('SS_HTTPResponse', $response, "$link should return a response object");
$this->assertEquals(200, $response->getStatusCode(), "$link should return 200 status code"); $this->assertEquals(200, $response->getStatusCode(), "$link should return 200 status code");
// Check that a HTML page has been returned // Check that a HTML page has been returned
$this->assertRegExp('/<html[^>]*>/i', $response->getBody(), "$link should contain <html> tag"); $this->assertRegExp('/<html[^>]*>/i', $response->getBody(), "$link should contain <html> tag");
Expand Down
2 changes: 1 addition & 1 deletion tests/MemberTableFieldTest.php
Expand Up @@ -72,7 +72,7 @@ function testDeleteWithGroupOnlyDeletesRelation() {
$this->assertNotContains($member1->ID, $group1->Members()->column('ID'), $this->assertNotContains($member1->ID, $group1->Members()->column('ID'),
'Member relation to group is removed' 'Member relation to group is removed'
); );
$this->assertInstanceOf( $this->assertType(
'DataObject', 'DataObject',
DataObject::get_by_id('Member', $member1->ID), DataObject::get_by_id('Member', $member1->ID),
'Member record still exists' 'Member record still exists'
Expand Down

0 comments on commit a220d37

Please sign in to comment.