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

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

public it_returns_a_response_for_html_view_of_paginated_resources ( 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\ResourcesCollectionProviderInterface $resourcesCollectionProvider, Sylius\Component\Resource\Model\ResourceInterface $resource1, Sylius\Component\Resource\Model\ResourceInterface $resource2, Sylius\Bundle\ResourceBundle\Controller\ViewHandlerInterface $viewHandler, 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
$resourcesCollectionProvider Sylius\Bundle\ResourceBundle\Controller\ResourcesCollectionProviderInterface
$resource1 Sylius\Component\Resource\Model\ResourceInterface
$resource2 Sylius\Component\Resource\Model\ResourceInterface
$viewHandler Sylius\Bundle\ResourceBundle\Controller\ViewHandlerInterface
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response
    function it_returns_a_response_for_html_view_of_paginated_resources(MetadataInterface $metadata, RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, ResourcesCollectionProviderInterface $resourcesCollectionProvider, ResourceInterface $resource1, ResourceInterface $resource2, ViewHandlerInterface $viewHandler, Request $request, Response $response)
    {
        $metadata->getApplicationName()->willReturn('sylius');
        $metadata->getName()->willReturn('product');
        $metadata->getPluralName()->willReturn('products');
        $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration);
        $configuration->hasPermission()->willReturn(true);
        $configuration->getPermission(ResourceActions::INDEX)->willReturn('sylius.product.index');
        $authorizationChecker->isGranted($configuration, 'sylius.product.index')->willReturn(true);
        $configuration->isHtmlRequest()->willReturn(true);
        $configuration->getTemplate(ResourceActions::INDEX . '.html')->willReturn('SyliusShopBundle:Product:index.html.twig');
        $resourcesCollectionProvider->get($configuration, $repository)->willReturn([$resource1, $resource2]);
        $expectedView = View::create()->setData(['configuration' => $configuration, 'metadata' => $metadata, 'resources' => [$resource1, $resource2], 'products' => [$resource1, $resource2]])->setTemplateVar('products')->setTemplate('SyliusShopBundle:Product:index.html.twig');
        $viewHandler->handle($configuration, Argument::that($this->getViewComparingCallback($expectedView)))->willReturn($response);
        $this->indexAction($request)->shouldReturn($response);
    }
ResourceControllerSpec