ProophTest\ServiceBus\Plugin\Guard\FinalizeGuardTest::it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access_without_deferred PHP Метод

it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access_without_deferred() публичный Метод

    public function it_stops_propagation_and_throws_unauthorizedexception_when_authorization_service_denies_access_without_deferred()
    {
        $authorizationService = $this->prophesize(AuthorizationService::class);
        $authorizationService->isGranted('test_event')->willReturn(false);
        $actionEvent = $this->prophesize(ActionEvent::class);
        $actionEvent->getParam(QueryBus::EVENT_PARAM_PROMISE)->willReturn(null);
        $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_NAME)->willReturn('test_event');
        $actionEvent->stopPropagation(true)->willReturn(null);
        $routeGuard = new FinalizeGuard($authorizationService->reveal());
        $routeGuard->onFinalize($actionEvent->reveal());
    }