public function testApplyToCollectionPaginationDisabled()
 {
     /** @var ObjectProphecy|Request $requestMock */
     $requestMock = $this->prophesize('Symfony\\Component\\HttpFoundation\\Request');
     /* @see PaginationExtension::applyToCollection */
     $this->requestStackMock->getCurrentRequest()->willReturn($requestMock->reveal())->shouldBeCalledTimes(1);
     /* @see PaginationExtension::isPaginationEnabled */
     $this->resourceMock->getEnablePaginationParameter()->willReturn('enablePagination')->shouldBeCalledTimes(1);
     $requestMock->get('enablePagination')->willReturn('true')->shouldBeCalledTimes(1);
     $this->resourceMock->isClientAllowedToEnablePagination()->willReturn(false)->shouldBeCalledTimes(1);
     $this->resourceMock->isPaginationEnabledByDefault()->willReturn(false)->shouldBeCalledTimes(1);
     /* @see PaginationExtension::getItemsPerPage */
     $this->resourceMock->isClientAllowedToChangeItemsPerPage()->shouldNotBeCalled();
     $this->resourceMock->getItemsPerPageParameter()->shouldNotBeCalled();
     $requestMock->get('itemsPerPage')->shouldNotBeCalled();
     /* @see PaginationExtension::getPage */
     $this->resourceMock->getPageParameter()->shouldNotBeCalled();
     $requestMock->get('page', 1)->shouldNotBeCalled();
     /* @see PaginationExtension::applyToCollection */
     $this->queryBuilderMock->setFirstResult(Argument::any())->shouldNotBeCalled();
     $this->queryBuilderMock->setMaxResults(Argument::any())->shouldNotBeCalled();
     $extension = new PaginationExtension($this->managerRegistryMock->reveal(), $this->requestStackMock->reveal());
     $extension->applyToCollection($this->resourceMock->reveal(), $this->queryBuilderMock->reveal());
 }
 /**
  * Gets the number of items per page to display.
  *
  * @param ResourceInterface $resource
  * @param Request           $request
  *
  * @return float
  */
 private function getItemsPerPage(ResourceInterface $resource, Request $request)
 {
     if ($resource->isClientAllowedToChangeItemsPerPage() && ($itemsPerPage = $request->get($resource->getItemsPerPageParameter()))) {
         return (double) $itemsPerPage;
     }
     return $resource->getItemsPerPageByDefault();
 }