mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Using post() instead of submitForm() in CMSMainTest to work around SimpleTest issues
This commit is contained in:
parent
2ab9a062b5
commit
8382ebb742
@ -198,22 +198,22 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
// with insufficient permissions
|
// with insufficient permissions
|
||||||
$cmsUser->logIn();
|
$cmsUser->logIn();
|
||||||
$this->get('admin/pages');
|
$this->get('admin/pages');
|
||||||
$response = $this->submitForm(
|
$response = $this->post(
|
||||||
'Form_AddForm',
|
'admin/pages/AddForm',
|
||||||
null,
|
array('ParentID' => '0', 'ClassName' => 'Page', 'Locale' => 'en_US', 'action_doAdd' => 1)
|
||||||
array('ParentID' => '0', 'ClassName' => 'Page', 'Locale' => 'en_US')
|
|
||||||
);
|
);
|
||||||
// should redirect, which is a permission error
|
// should redirect, which is a permission error
|
||||||
$this->assertEquals(403, $response->getStatusCode(), 'Add TopLevel page must fail for normal user');
|
$this->assertEquals(403, $response->getStatusCode(), 'Add TopLevel page must fail for normal user');
|
||||||
|
|
||||||
// with correct permissions
|
// with correct permissions
|
||||||
$rootEditUser->logIn();
|
$rootEditUser->logIn();
|
||||||
$this->get('admin/pages/');
|
$response = $this->get('admin/pages/');
|
||||||
$response = $this->submitForm(
|
|
||||||
'Form_AddForm',
|
$response = $this->post(
|
||||||
null,
|
'admin/pages/AddForm',
|
||||||
array('ParentID' => '0', 'ClassName' => 'Page', 'Locale' => 'en_US')
|
array('ParentID' => '0', 'ClassName' => 'Page', 'Locale' => 'en_US', 'action_doAdd' => 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(302, $response->getStatusCode(), 'Must be a redirect on success');
|
$this->assertEquals(302, $response->getStatusCode(), 'Must be a redirect on success');
|
||||||
$location=$response->getHeader('Location');
|
$location=$response->getHeader('Location');
|
||||||
$this->assertContains('/show/',$location, 'Must redirect to /show/ the new page');
|
$this->assertContains('/show/',$location, 'Must redirect to /show/ the new page');
|
||||||
|
Loading…
Reference in New Issue
Block a user