MINOR Changed CMSMainTest to use new LeftAndMain->doAdd() controller actions, not the removed addform()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102787 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-14 03:07:25 +00:00
parent 47dfe8b2ab
commit 6ea662cd05

View File

@ -171,13 +171,23 @@ class CMSMainTest extends FunctionalTest {
// with insufficient permissions
$cmsUser->logIn();
$response = $this->post('admin/addpage', array('ParentID' => '0', 'PageType' => 'Page', 'Locale' => 'en_US'));
$this->get('admin');
$response = $this->submitForm(
'Form_AddForm',
null,
array('ParentID' => '0', 'PageType' => 'Page', 'Locale' => 'en_US')
);
// should redirect, which is a permission error
$this->assertEquals(403, $response->getStatusCode(), 'Add TopLevel page must fail for normal user');
// with correct permissions
$rootEditUser->logIn();
$response = $this->post('admin/addpage', array('ParentID' => '0', 'PageType' => 'Page', 'Locale' => 'en_US'));
$this->get('admin');
$response = $this->submitForm(
'Form_AddForm',
null,
array('ParentID' => '0', 'PageType' => 'Page', 'Locale' => 'en_US')
);
$this->assertEquals(302, $response->getStatusCode(), 'Must be a redirect on success');
$location=$response->getHeader('Location');
$this->assertContains('/show/',$location, 'Must redirect to /show/ the new page');