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
This commit is contained in:
Ingo Schommer 2009-07-08 04:06:23 +00:00
parent 883be66524
commit b8736bd5b2

View File

@ -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');
}