Changed automatic token generation to throw an exception instead
This commit is contained in:
parent
8ab59cb1c2
commit
22b44e251f
@ -57,8 +57,7 @@ class GuardListener
|
||||
$token = $this->tokenStorage->getToken();
|
||||
|
||||
if (null === $token) {
|
||||
$token = new AnonymousToken('secret', 'anon', array());
|
||||
$this->tokenStorage->setToken($token);
|
||||
throw new \Exception("No token is set");
|
||||
}
|
||||
|
||||
if (null !== $this->roleHierarchy) {
|
||||
|
@ -74,13 +74,9 @@ class GuardListenerTest extends TestCase
|
||||
$event = $this->createEvent();
|
||||
$this->tokenStorage = null;
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
$this->listener->onTransition($event, 'event_name_a');
|
||||
|
||||
$this->assertFalse($event->isBlocked());
|
||||
|
||||
$this->listener->onTransition($event, 'event_name_b');
|
||||
|
||||
$this->assertTrue($event->isBlocked());
|
||||
}
|
||||
|
||||
private function createEvent()
|
||||
|
Reference in New Issue
Block a user