Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (26 sloc) 1.17 kb
* @package cms
* @subpackage tests
class ContentControllerPermissionsTest extends FunctionalTest {
protected $usesDatabase = true;
protected $autoFollowRedirection = false;
public function testCanViewStage() {
$page = new Page();
$page->URLSegment = 'testpage';
$page->publish('Stage', 'Live');
$response = $this->get('/testpage');
$this->assertEquals($response->getStatusCode(), 200, 'Doesnt 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');
// should redirect to login
$this->assertEquals($response->getStatusCode(), 302, 'Redirects to login page when not logged in for draft stage');
$this->assertContains('Security/login', $response->getHeader('Location'));
$response = $this->get('/testpage/?stage=Stage');
$this->assertEquals($response->getStatusCode(), 200, 'Doesnt redirect to login, but shows page for authenticated user');
Jump to Line
Something went wrong with that request. Please try again.