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
This commit is contained in:
Sam Minnee 2009-10-19 05:26:03 +00:00
parent 3b8389168e
commit 4b7a3e20fb

View File

@ -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('/<input[^>]+type="submit"[^>]+name="action_deletefromlive"/i', $response->getBody());
}