BUG FIx merge regressions in versioned tests

This commit is contained in:
Damian Mooyman 2015-12-22 17:46:07 +13:00
parent ad1c058616
commit 54ae002d19
3 changed files with 20 additions and 6 deletions

View File

@ -21,12 +21,16 @@ class ContentControllerPermissionsTest extends FunctionalTest {
$page->write();
$response = $this->get('/testpage');
$this->assertEquals($response->getStatusCode(), 200, 'Doesnt require login for implicit live stage');
$this->assertEquals($response->getStatusCode(), 200, "Doesn't require login for implicit live stage");
$response = $this->get('/testpage/?stage=Live');
$this->assertEquals($response->getStatusCode(), 200, 'Doesnt require login for explicit live stage');
$response = $this->get('/testpage/?stage=Stage');
$this->assertEquals($response->getStatusCode(), 200, "Doesn't require login for explicit live stage");
try {
$response = $this->get('/testpage/?stage=Stage');
} catch(SS_HTTPResponse_Exception $responseException) {
$response = $responseException->getResponse();
}
// should redirect to login
$this->assertEquals($response->getStatusCode(), 302, 'Redirects to login page when not logged in for draft stage');
$this->assertContains(

View File

@ -96,7 +96,13 @@ class ContentControllerTest extends FunctionalTest {
// test when user does not have permission, should get login form
$this->logInWithPermission('EDITOR');
$this->assertEquals('403', $this->get('/contact/?stage=Stage')->getstatusCode());
try {
$response = $this->get('/contact/?stage=Stage');
} catch(SS_HTTPResponse_Exception $responseException) {
$response = $responseException->getResponse();
}
$this->assertEquals('403', $response->getstatusCode());
// test when user does have permission, should show page title and header ok.

View File

@ -40,7 +40,11 @@ class SiteTreePermissionsTest extends FunctionalTest {
$this->assertEquals($response->getStatusCode(), '404');
// should be prompted for a login
$response = $this->get($page->URLSegment . '?stage=Stage');
try {
$response = $this->get($page->URLSegment . '?stage=Stage');
} catch(SS_HTTPResponse_Exception $responseException) {
$response = $responseException->getResponse();
}
$this->assertEquals($response->getStatusCode(), '302');
$this->assertContains(
Config::inst()->get('Security', 'login_url'),