Inheritance: implements Prooph\Common\Event\ActionEventListenerAggregate, use trait Prooph\Common\Event\DetachAggregateHandlers
Example #1
0
 /**
  * @test
  * @expectedException Prooph\ServiceBus\Plugin\Guard\UnauthorizedException
  */
 public function it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access()
 {
     $authorizationService = $this->prophesize(AuthorizationService::class);
     $authorizationService->isGranted('test_event')->willReturn(false);
     $actionEvent = $this->prophesize(ActionEvent::class);
     $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_NAME)->willReturn('test_event');
     $actionEvent->stopPropagation(true)->willReturn(null);
     $routeGuard = new RouteGuard($authorizationService->reveal());
     $routeGuard->onRoute($actionEvent->reveal());
 }