From b8736bd5b258760190e53c5068d34b7498acb96b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 8 Jul 2009 04:06:23 +0000 Subject: [PATCH] BUGFIX Fixed SiteTreeTest to work with new fixture handling: objFromFixture() can no longer be used to determine if an item has been deleted, as it will throw a warning git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81319 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/SiteTreeTest.php | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tests/SiteTreeTest.php b/tests/SiteTreeTest.php index 9f332451c..28e9481a6 100644 --- a/tests/SiteTreeTest.php +++ b/tests/SiteTreeTest.php @@ -243,27 +243,32 @@ class SiteTreeTest extends SapphireTest { function testDeleteFromStageOperatesRecursively() { - $parentPage = $this->objFromFixture('Page', 'about'); - $parentPage->delete(); + $pageAbout = $this->objFromFixture('Page', 'about'); + $pageStaff = $this->objFromFixture('Page', 'staff'); + $pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate'); - $this->assertFalse($this->objFromFixture('Page', 'about')); - $this->assertFalse($this->objFromFixture('Page', 'staff')); - $this->assertFalse($this->objFromFixture('Page', 'staffduplicate')); + $pageAbout->delete(); + + $this->assertFalse(DataObject::get_by_id('Page', $pageAbout->ID)); + $this->assertFalse(DataObject::get_by_id('Page', $pageStaff->ID)); + $this->assertFalse(DataObject::get_by_id('Page', $pageStaffDuplicate->ID)); } function testDeleteFromLiveOperatesRecursively() { - $this->objFromFixture('Page', 'about')->doPublish(); - $this->objFromFixture('Page', 'staff')->doPublish(); - $this->objFromFixture('Page', 'staffduplicate')->doPublish(); - + $pageAbout = $this->objFromFixture('Page', 'about'); + $pageAbout->doPublish(); + $pageStaff = $this->objFromFixture('Page', 'staff'); + $pageStaff->doPublish(); + $pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate'); + $pageStaffDuplicate->doPublish(); $parentPage = $this->objFromFixture('Page', 'about'); $parentPage->doDeleteFromLive(); Versioned::reading_stage('Live'); - $this->assertFalse($this->objFromFixture('Page', 'about')); - $this->assertFalse($this->objFromFixture('Page', 'staff')); - $this->assertFalse($this->objFromFixture('Page', 'staffduplicate')); + $this->assertFalse(DataObject::get_by_id('Page', $pageAbout->ID)); + $this->assertFalse(DataObject::get_by_id('Page', $pageStaff->ID)); + $this->assertFalse(DataObject::get_by_id('Page', $pageStaffDuplicate->ID)); Versioned::reading_stage('Stage'); }