ProophTest\ServiceBus\Plugin\Guard\RouteGuardTest::it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access PHP Method

it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access() public method

    public function it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access()
    {
        $authorizationService = $this->prophesize(AuthorizationService::class);
        $authorizationService->isGranted('test_event', new \stdClass())->willReturn(false);
        $actionEvent = $this->prophesize(ActionEvent::class);
        $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_NAME)->willReturn('test_event');
        $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE)->willReturn(new \stdClass());
        $actionEvent->stopPropagation(true)->willReturn(null);
        $routeGuard = new RouteGuard($authorizationService->reveal());
        $routeGuard->onRoute($actionEvent->reveal());
    }