spec\Sylius\Bundle\ResourceBundle\Controller\ResourceControllerSpec::it_returns_a_response_for_html_view_of_a_single_resource PHP Метод

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

public it_returns_a_response_for_html_view_of_a_single_resource ( Sylius\Component\Resource\Metadata\MetadataInterface $metadata, Sylius\Bundle\ResourceBundle\Controller\RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, Sylius\Bundle\ResourceBundle\Controller\AuthorizationCheckerInterface $authorizationChecker, Sylius\Component\Resource\Repository\RepositoryInterface $repository, Sylius\Bundle\ResourceBundle\Controller\SingleResourceProviderInterface $singleResourceProvider, Sylius\Component\Resource\Model\ResourceInterface $resource, Sylius\Bundle\ResourceBundle\Controller\ViewHandlerInterface $viewHandler, Sylius\Bundle\ResourceBundle\Controller\EventDispatcherInterface $eventDispatcher, Request $request, Response $response )
$metadata Sylius\Component\Resource\Metadata\MetadataInterface
$requestConfigurationFactory Sylius\Bundle\ResourceBundle\Controller\RequestConfigurationFactoryInterface
$configuration Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration
$authorizationChecker Sylius\Bundle\ResourceBundle\Controller\AuthorizationCheckerInterface
$repository Sylius\Component\Resource\Repository\RepositoryInterface
$singleResourceProvider Sylius\Bundle\ResourceBundle\Controller\SingleResourceProviderInterface
$resource Sylius\Component\Resource\Model\ResourceInterface
$viewHandler Sylius\Bundle\ResourceBundle\Controller\ViewHandlerInterface
$eventDispatcher Sylius\Bundle\ResourceBundle\Controller\EventDispatcherInterface
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response
    function it_returns_a_response_for_html_view_of_a_single_resource(MetadataInterface $metadata, RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, SingleResourceProviderInterface $singleResourceProvider, ResourceInterface $resource, ViewHandlerInterface $viewHandler, EventDispatcherInterface $eventDispatcher, Request $request, Response $response)
    {
        $metadata->getApplicationName()->willReturn('sylius');
        $metadata->getName()->willReturn('product');
        $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration);
        $configuration->hasPermission()->willReturn(true);
        $configuration->getPermission(ResourceActions::SHOW)->willReturn('sylius.product.show');
        $authorizationChecker->isGranted($configuration, 'sylius.product.show')->willReturn(true);
        $singleResourceProvider->get($configuration, $repository)->willReturn($resource);
        $configuration->isHtmlRequest()->willReturn(true);
        $configuration->getTemplate(ResourceActions::SHOW . '.html')->willReturn('SyliusShopBundle:Product:show.html.twig');
        $eventDispatcher->dispatch(ResourceActions::SHOW, $configuration, $resource)->shouldBeCalled();
        $expectedView = View::create()->setData(['configuration' => $configuration, 'metadata' => $metadata, 'resource' => $resource, 'product' => $resource])->setTemplateVar('product')->setTemplate('SyliusShopBundle:Product:show.html.twig');
        $viewHandler->handle($configuration, Argument::that($this->getViewComparingCallback($expectedView)))->willReturn($response);
        $this->showAction($request)->shouldReturn($response);
    }
ResourceControllerSpec