Avoid exception driven logic

This commit is contained in:
Romain Neutron
2014-02-05 14:21:28 +01:00
parent beceb9350b
commit b9e4c599b2
49 changed files with 114 additions and 101 deletions

View File

@@ -2,24 +2,18 @@
namespace Alchemy\Tests\Phrasea\Security;
use Alchemy\Phrasea\Security\Firewall;
class FirewallTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
public function testRequiredAuth()
{
$res = self::$DI['app']['firewall']->requireAuthentication(self::$DI['app']);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Security\\Firewall', $res);
$this->assertNull(self::$DI['app']['firewall']->requireAuthentication(self::$DI['app']));
}
/**
* @expectedException Symfony\Component\HttpKernel\Exception\HttpException
*/
public function testRequiredAuthNotAuthenticated()
{
$this->logout(self::$DI['app']);
self::$DI['app']['firewall']->requireAuthentication(self::$DI['app']);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', self::$DI['app']['firewall']->requireAuthentication(self::$DI['app']));
}
}