Skip to content

Commit

Permalink
Update PHPUnit (9 --> 10) (#800)
Browse files Browse the repository at this point in the history
* Bump PHPUnit version

* Apply cs-fixer

* Update rule sets regarding PHP and PHPUnit
  • Loading branch information
W0rma authored Aug 5, 2024
1 parent 47c59f9 commit 85ca0ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
'@PHP81Migration' => true,
'@PHPUnit100Migration:risky' => true,
'ordered_imports' => true,
'declare_strict_types' => false,
'native_function_invocation' => ['include' => ['@all']],
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"require-dev": {
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^10.5 || ^11.3",
"symfony/expression-language": "^6.4 || ^7.0",
"symfony/templating": "^6.4 || ^7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/KnpPaginatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

final class KnpPaginatorExtension extends Extension
{
Expand Down
13 changes: 5 additions & 8 deletions tests/Pagination/SlidingPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Knp\Bundle\PaginatorBundle\Tests\Pagination;

use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -19,9 +20,7 @@ protected function setUp(): void
$this->pagination = new SlidingPagination([]);
}

/**
* @dataProvider getPageLimitData
*/
#[DataProvider('getPageLimitData')]
public function testGetPageCount(int $expected, int $totalItemCount, int $itemsPerPage, ?int $pageLimit): void
{
$this->pagination->setTotalItemCount($totalItemCount);
Expand All @@ -31,9 +30,7 @@ public function testGetPageCount(int $expected, int $totalItemCount, int $itemsP
$this->assertSame($expected, $this->pagination->getPageCount());
}

/**
* @dataProvider getSortedData
*/
#[DataProvider('getSortedData')]
public function testSorted(bool $expected, string $sort, string $direction, $key): void
{
$this->pagination->setPaginatorOptions([
Expand All @@ -46,7 +43,7 @@ public function testSorted(bool $expected, string $sort, string $direction, $key
$this->assertSame($expected, $this->pagination->isSorted($key));
}

public function getPageLimitData(): array
public static function getPageLimitData(): array
{
return [
'Normal' => [5, 120, 25, null],
Expand All @@ -56,7 +53,7 @@ public function getPageLimitData(): array
];
}

public function getSortedData(): \Generator
public static function getSortedData(): \Generator
{
yield [true, 'title', 'asc', null];
yield [true, 'title', 'asc', 'title'];
Expand Down

0 comments on commit 85ca0ac

Please sign in to comment.