diff --git a/composer.json b/composer.json index fa8cc972..1123084d 100644 --- a/composer.json +++ b/composer.json @@ -65,20 +65,19 @@ "devster/ubench": "^2.1", "phpstan/phpstan": "^2.1", "phpstan/phpstan-doctrine": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-phpunit": "^2.0.5", "phpstan/phpstan-symfony": "^2.0", "phpunit/php-code-coverage": "^12.0", "phpunit/phpcov": "^11.0", - "phpunit/phpunit": "^12.0", + "phpunit/phpunit": "^12.0.10", "roave/security-advisories": "dev-master", - "shlinkio/php-coding-standard": "~2.4.0", + "shlinkio/php-coding-standard": "~2.4.2", "shlinkio/shlink-test-utils": "^4.3.1", "symfony/var-dumper": "^7.2", "veewee/composer-run-parallel": "^1.4" }, "conflict": { - "symfony/var-exporter": ">=6.3.9,<=6.4.0", - "phpunit/phpunit": "12.0.9" + "symfony/var-exporter": ">=6.3.9,<=6.4.0" }, "autoload": { "psr-4": { diff --git a/module/Core/test/EventDispatcher/RabbitMq/NotifyVisitToRabbitMqTest.php b/module/Core/test/EventDispatcher/RabbitMq/NotifyVisitToRabbitMqTest.php index a3cebaa7..8af719b3 100644 --- a/module/Core/test/EventDispatcher/RabbitMq/NotifyVisitToRabbitMqTest.php +++ b/module/Core/test/EventDispatcher/RabbitMq/NotifyVisitToRabbitMqTest.php @@ -70,6 +70,9 @@ class NotifyVisitToRabbitMqTest extends TestCase ($this->listener())(new UrlVisited($visitId)); } + /** + * @param non-empty-string[] $expectedChannels + */ #[Test, DataProvider('provideVisits')] public function expectedChannelsAreNotifiedBasedOnTheVisitType(Visit $visit, array $expectedChannels): void { diff --git a/module/Core/test/Geolocation/Middleware/IpGeolocationMiddlewareTest.php b/module/Core/test/Geolocation/Middleware/IpGeolocationMiddlewareTest.php index 210fb46f..96eb158f 100644 --- a/module/Core/test/Geolocation/Middleware/IpGeolocationMiddlewareTest.php +++ b/module/Core/test/Geolocation/Middleware/IpGeolocationMiddlewareTest.php @@ -118,6 +118,9 @@ class IpGeolocationMiddlewareTest extends TestCase $this->middleware()->process($request, $this->handler); } + /** + * @param non-empty-string $loggerMethod + */ #[Test] #[TestWith([ new WrongIpException(), diff --git a/module/Core/test/Matomo/MatomoVisitSenderTest.php b/module/Core/test/Matomo/MatomoVisitSenderTest.php index 7d66d868..1b1b303c 100644 --- a/module/Core/test/Matomo/MatomoVisitSenderTest.php +++ b/module/Core/test/Matomo/MatomoVisitSenderTest.php @@ -24,6 +24,8 @@ use Shlinkio\Shlink\Core\Visit\Model\Visitor; use Shlinkio\Shlink\Core\Visit\Repository\VisitIterationRepositoryInterface; use Shlinkio\Shlink\IpGeolocation\Model\Location; +use function array_values; + class MatomoVisitSenderTest extends TestCase { private MockObject & MatomoTrackerBuilderInterface $trackerBuilder; @@ -42,10 +44,10 @@ class MatomoVisitSenderTest extends TestCase ); } - #[Test, DataProvider('provideTrackerMethods')] /** - * @param array $invokedMethods + * @param array $invokedMethods */ + #[Test, DataProvider('provideTrackerMethods')] public function visitIsSentToMatomo(Visit $visit, string|null $originalIpAddress, array $invokedMethods): void { $tracker = $this->createMock(MatomoTracker::class); @@ -70,7 +72,9 @@ class MatomoVisitSenderTest extends TestCase } foreach ($invokedMethods as $invokedMethod => $args) { - $tracker->expects($this->once())->method($invokedMethod)->with(...$args)->willReturn($tracker); + $tracker->expects($this->once())->method($invokedMethod)->with(...array_values($args))->willReturn( + $tracker, + ); } $this->trackerBuilder->expects($this->once())->method('buildMatomoTracker')->willReturn($tracker); diff --git a/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php b/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php index 787ca294..1c55bc0d 100644 --- a/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php +++ b/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php @@ -13,7 +13,7 @@ use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Stream; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\TestWith; -use PHPUnit\Framework\MockObject\Builder\InvocationMocker; +use PHPUnit\Framework\MockObject\InvocationStubber; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -152,9 +152,8 @@ class ShortUrlTitleResolutionHelperTest extends TestCase } /** - * @return InvocationMocker */ - private function expectRequestToBeCalled(): InvocationMocker + private function expectRequestToBeCalled(): InvocationStubber { return $this->httpClient->expects($this->once())->method('request')->with( RequestMethodInterface::METHOD_GET, diff --git a/module/Core/test/Visit/Geolocation/VisitLocatorTest.php b/module/Core/test/Visit/Geolocation/VisitLocatorTest.php index cd6f12da..68c746d7 100644 --- a/module/Core/test/Visit/Geolocation/VisitLocatorTest.php +++ b/module/Core/test/Visit/Geolocation/VisitLocatorTest.php @@ -40,6 +40,9 @@ class VisitLocatorTest extends TestCase $this->visitService = new VisitLocator($this->em, $this->repo); } + /** + * @param non-empty-string $expectedRepoMethodName + */ #[Test, DataProvider('provideMethodNames')] public function locateVisitsIteratesAndLocatesExpectedVisits( string $serviceMethodName, @@ -80,6 +83,9 @@ class VisitLocatorTest extends TestCase yield 'locateAllVisits' => ['locateAllVisits', 'findAllVisits']; } + /** + * @param non-empty-string $expectedRepoMethodName + */ #[Test, DataProvider('provideIsNonLocatableAddress')] public function visitsWhichCannotBeLocatedAreIgnoredOrLocatedAsEmpty( string $serviceMethodName,