mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
|
|
|
|
class FirewallTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|
{
|
|
protected $client;
|
|
|
|
public function createApplication()
|
|
{
|
|
$app = require __DIR__ . '/../../../../lib/Alchemy/Phrasea/Application/Admin.php';
|
|
|
|
$app['debug'] = true;
|
|
unset($app['exception_handler']);
|
|
|
|
return $app;
|
|
}
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
$this->client = $this->createClient();
|
|
}
|
|
|
|
public function testRequiredAuth()
|
|
{
|
|
$core = \bootstrap::getCore();
|
|
$response = $core['Firewall']->requireAuthentication($this->app);
|
|
$this->assertNull($response);
|
|
$appbox = \appbox::get_instance($core);
|
|
$session = $appbox->get_session();
|
|
$session->logout();
|
|
$response = $core['Firewall']->requireAuthentication($this->app);
|
|
$this->assertTrue($response->isRedirect());
|
|
$this->assertEquals('/login/', $response->headers->get('location'));
|
|
}
|
|
}
|
|
|
|
?>
|