2009-12-02 10:40:45 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class ContentControllerPermissionTest extends FunctionalTest {
|
|
|
|
|
|
|
|
protected $usesDatabase = true;
|
|
|
|
|
|
|
|
protected $autoFollowRedirection = false;
|
|
|
|
|
|
|
|
public function testCanViewStage() {
|
|
|
|
$page = new Page();
|
|
|
|
$page->URLSegment = 'testpage';
|
|
|
|
$page->write();
|
|
|
|
$page->publish('Stage', 'Live');
|
|
|
|
|
|
|
|
$response = $this->get('/testpage');
|
|
|
|
$this->assertEquals($response->getStatusCode(), 200);
|
|
|
|
|
|
|
|
$response = $this->get('/testpage/?stage=Live');
|
|
|
|
$this->assertEquals($response->getStatusCode(), 200);
|
|
|
|
|
|
|
|
$response = $this->get('/testpage/?stage=Stage');
|
|
|
|
// should redirect to login
|
|
|
|
$this->assertEquals($response->getStatusCode(), 302);
|
|
|
|
|
2010-04-28 09:16:21 +02:00
|
|
|
$this->logInWithPermission('CMS_ACCESS_CMSMain');
|
2009-12-02 10:40:45 +01:00
|
|
|
|
|
|
|
$response = $this->get('/testpage/?stage=Stage');
|
|
|
|
$this->assertEquals($response->getStatusCode(), 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|