mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUG Fix CMSMainTest attempting to render page on Security permission error
This commit is contained in:
parent
c7814cffc9
commit
6c92a86d2e
@ -245,7 +245,15 @@ class CMSMainTest extends FunctionalTest {
|
||||
$this->get('admin/pages/add');
|
||||
$response = $this->post(
|
||||
'admin/pages/add/AddForm',
|
||||
array('ParentID' => '0', 'ClassName' => 'Page', 'Locale' => 'en_US', 'action_doAdd' => 1)
|
||||
array(
|
||||
'ParentID' => '0',
|
||||
'ClassName' => 'Page',
|
||||
'Locale' => 'en_US',
|
||||
'action_doAdd' => 1,
|
||||
'ajax' => 1,
|
||||
), array(
|
||||
'X-Pjax' => 'CurrentForm,Breadcrumbs',
|
||||
)
|
||||
);
|
||||
// should redirect, which is a permission error
|
||||
$this->assertEquals(403, $response->getStatusCode(), 'Add TopLevel page must fail for normal user');
|
||||
@ -256,11 +264,19 @@ class CMSMainTest extends FunctionalTest {
|
||||
|
||||
$response = $this->post(
|
||||
'admin/pages/add/AddForm',
|
||||
array('ParentID' => '0', 'ClassName' => 'Page', 'Locale' => 'en_US', 'action_doAdd' => 1)
|
||||
array(
|
||||
'ParentID' => '0',
|
||||
'ClassName' => 'Page',
|
||||
'Locale' => 'en_US',
|
||||
'action_doAdd' => 1,
|
||||
'ajax' => 1,
|
||||
), array(
|
||||
'X-Pjax' => 'CurrentForm,Breadcrumbs',
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(302, $response->getStatusCode(), 'Must be a redirect on success');
|
||||
$location=$response->getHeader('Location');
|
||||
$location = $response->getHeader('X-ControllerURL');
|
||||
$this->assertNotEmpty($location, 'Must be a redirect on success');
|
||||
$this->assertContains('/show/',$location, 'Must redirect to /show/ the new page');
|
||||
// TODO Logout
|
||||
$this->session()->inst_set('loggedInAs', NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user