mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Merge pull request #2403 from acelaya-forks/feature/phpunit-phpstan-fixes
Fix compatibility with PHPUnit 12.0.9 and phpstan-phpunit
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -118,6 +118,9 @@ class IpGeolocationMiddlewareTest extends TestCase
|
||||
$this->middleware()->process($request, $this->handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $loggerMethod
|
||||
*/
|
||||
#[Test]
|
||||
#[TestWith([
|
||||
new WrongIpException(),
|
||||
|
||||
@@ -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<string, string[]> $invokedMethods
|
||||
* @param array<non-empty-string, string[]> $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);
|
||||
|
||||
@@ -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<ClientInterface>
|
||||
*/
|
||||
private function expectRequestToBeCalled(): InvocationMocker
|
||||
private function expectRequestToBeCalled(): InvocationStubber
|
||||
{
|
||||
return $this->httpClient->expects($this->once())->method('request')->with(
|
||||
RequestMethodInterface::METHOD_GET,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user