From 4b7a3e20fbc6aada599f60b0e8c00191207322ab Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 19 Oct 2009 05:26:03 +0000 Subject: [PATCH] MINOR: Made security fixture set-up tigher in a test. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@89457 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/CMSMainTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/CMSMainTest.php b/tests/CMSMainTest.php index fb0be0ed..919ba7bb 100644 --- a/tests/CMSMainTest.php +++ b/tests/CMSMainTest.php @@ -90,15 +90,20 @@ class CMSMainTest extends FunctionalTest { * Test that a draft-deleted page can still be opened in the CMS */ function testDraftDeletedPageCanBeOpenedInCMS() { + $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin')); + // Set up a page that is delete from live $page = $this->objFromFixture('Page','page1'); $pageID = $page->ID; $page->doPublish(); $page->delete(); - $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin')); $response = $this->get('admin/cms/getitem?ID=' . $pageID . '&ajax=1'); + $livePage = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID"); + $this->assertType('SiteTree', $livePage); + $this->assertTrue($livePage->canDelete()); + // Check that the 'delete from live' button exists as a simple way of checking that the correct page is returned. $this->assertRegExp('/]+type="submit"[^>]+name="action_deletefromlive"/i', $response->getBody()); }