Skip to content

Commit

Permalink
bug #417 Revert "Revert "Bump Pagerfanta from 2.x to 3.x"" (lchrusciel)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.9 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | reverts #416 for higher branches
| License         | MIT


Commits
-------

b658b28 Revert "Revert "Bump Pagerfanta from 2.x to 3.x""
  • Loading branch information
lchrusciel authored Apr 11, 2022
2 parents 0ec67cd + b658b28 commit b595b4f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"doctrine/orm": "^2.5",
"lchrusciel/api-test-case": "^5.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.2.1",
"pagerfanta/pagerfanta": "^3.0",
"pamil/phpspec-skip-example-extension": "^4.2",
"phpspec/phpspec": "^7.2",
"phpspec/prophecy-phpunit": "^2.0",
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ parameters:
- '/Method Sylius\\Component\\Resource\\Model\\TimestampableInterface::setUpdatedAt\(\) has no return typehint specified./'
- '/Method Symfony\\Component\\Routing\\RouteCollection::add\(\) invoked with 3 parameters, 2 required\./'
- '/Method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 1 required\./'
- '/Parameter \#1 \$currentPage of method Pagerfanta\\Pagerfanta<mixed>::setCurrentPage\(\) expects int<1, max>, int given\./'
- '/Parameter \#1 \$maxPerPage of method Pagerfanta\\Pagerfanta<mixed>::setMaxPerPage\(\) expects int<1, max>, int given\./'
- '/Parameter \#1 \$array[0-9]? of function array_multisort expects array, array\|int given\./'
- '/Parameter \#2 \$class of static method Webmozart\\Assert\\Assert::isInstanceOf\(\) expects class-string<object>, string given./'
- '/Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class-string<object>|object, object|string given./'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function reverseTransform($value): ?ResourceInterface
return null;
}

/** @var ResourceInterface|null $resource */
$resource = $this->repository->findOneBy([$this->identifier => $value]);
if (null === $resource) {
throw new TransformationFailedException(sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

namespace Sylius\Bundle\ResourceBundle\Tests\DependencyInjection\Compiler;

use BabDev\PagerfantaBundle\Twig\PagerfantaExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
use Pagerfanta\Twig\Extension\PagerfantaExtension;
use Pagerfanta\View\ViewFactory;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\PagerfantaBridgePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function it_handles_Pagerfanta(

$paginator->setMaxPerPage(5)->shouldBeCalled();
$paginator->setCurrentPage(6)->shouldBeCalled();
$paginator->getCurrentPageResults()->shouldBeCalled();
$paginator->getCurrentPageResults()->willReturn([]);

$this->get($requestConfiguration, $repository)->shouldReturn($paginator);
}
Expand Down Expand Up @@ -109,7 +109,7 @@ function it_restricts_max_pagination_limit_based_on_grid_configuration(

$paginator->setMaxPerPage(99)->shouldBeCalled();
$paginator->setCurrentPage(1)->shouldBeCalled();
$paginator->getCurrentPageResults()->shouldBeCalled();
$paginator->getCurrentPageResults()->willReturn([]);

$this->get($requestConfiguration, $repository)->shouldReturn($gridView);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ function it_creates_a_paginated_representation_for_pagerfanta_for_non_html_reque

$paginator->setMaxPerPage(8)->shouldBeCalled();
$paginator->setCurrentPage(6)->shouldBeCalled();
$paginator->getCurrentPageResults()->shouldBeCalled();
$paginator->getCurrentPageResults()->willReturn([]);

$pagerfantaRepresentationFactory->createRepresentation($paginator, Argument::type(Route::class))->willReturn($paginatedRepresentation);

Expand Down Expand Up @@ -177,7 +177,7 @@ function it_handles_resource_grid_view(

$paginator->setMaxPerPage(5)->shouldBeCalled();
$paginator->setCurrentPage(6)->shouldBeCalled();
$paginator->getCurrentPageResults()->shouldBeCalled();
$paginator->getCurrentPageResults()->willReturn([]);

$this->get($requestConfiguration, $repository)->shouldReturn($resourceGridView);
}
Expand Down

0 comments on commit b595b4f

Please sign in to comment.