mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
8bf1dc5eee
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@94253 467b73ca-7a2a-4603-9d3b-597d59a354a9
35 lines
870 B
PHP
35 lines
870 B
PHP
<?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);
|
|
|
|
$this->logInWithPermssion('CMS_ACCESS_CMSMain');
|
|
|
|
$response = $this->get('/testpage/?stage=Stage');
|
|
$this->assertEquals($response->getStatusCode(), 200);
|
|
}
|
|
|
|
|
|
} |