8000 Changed automatic token generation to throw an exception instead · symfony/symfony@22b44e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22b44e2

Browse files
author
GDIBass
committed
Changed automatic token generation to throw an exception instead
1 parent 8ab59cb commit 22b44e2

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/Symfony/Component/Workflow/EventListener/GuardListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ private function getVariables(GuardEvent $event)
5757
$token = $this->tokenStorage->getToken();
5858

5959
if (null === $token) {
60-
$token = new AnonymousToken('secret', 'anon', array());
61-
$this->tokenStorage->setToken($token);
60+
throw new \Exception("No token is set");
6261
}
6362

6463
if (null !== $this->roleHierarchy) {

src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,9 @@ public function testWithNoTokenStorage()
7474
$event = $this->createEvent();
7575
$this->tokenStorage = null;
7676

77-
$this->listener->onTransition($event, 'event_name_a');
78-
79-
$this->assertFalse($event->isBlocked());
77+
$this->expectException(\Exception::class);
8078

81-
$this->listener->onTransition($event, 'event_name_b');
82-
83-
$this->assertTrue($event->isBlocked());
79+
$this->listener->onTransition($event, 'event_name_a');
8480
}
8581

8682
private function createEvent()

0 commit comments

Comments
 (0)
0