mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Fixed all phpstan inspections on tests
This commit is contained in:
@@ -115,8 +115,10 @@ class QrCodeActionTest extends TestCase
|
||||
$delegate = $this->createMock(RequestHandlerInterface::class);
|
||||
|
||||
$resp = $this->action($defaultOptions)->process($req->withAttribute('shortCode', $code), $delegate);
|
||||
[$size] = getimagesizefromstring($resp->getBody()->__toString());
|
||||
$result = getimagesizefromstring($resp->getBody()->__toString());
|
||||
self::assertNotFalse($result);
|
||||
|
||||
[$size] = $result;
|
||||
self::assertEquals($expectedSize, $size);
|
||||
}
|
||||
|
||||
@@ -207,8 +209,9 @@ class QrCodeActionTest extends TestCase
|
||||
|
||||
$resp = $this->action($defaultOptions)->process($req, $delegate);
|
||||
$image = imagecreatefromstring($resp->getBody()->__toString());
|
||||
$color = imagecolorat($image, 1, 1);
|
||||
self::assertNotFalse($image);
|
||||
|
||||
$color = imagecolorat($image, 1, 1);
|
||||
self::assertEquals($color, $expectedColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,10 @@ class DomainServiceTest extends TestCase
|
||||
{
|
||||
$default = DomainItem::forDefaultDomain('default.com', new EmptyNotFoundRedirectConfig());
|
||||
$adminApiKey = ApiKey::create();
|
||||
$domain = Domain::withAuthority('');
|
||||
$domain->setId('123');
|
||||
$domainSpecificApiKey = ApiKey::fromMeta(
|
||||
ApiKeyMeta::withRoles(RoleDefinition::forDomain(Domain::withAuthority('')->setId('123'))),
|
||||
ApiKeyMeta::withRoles(RoleDefinition::forDomain($domain)),
|
||||
);
|
||||
|
||||
yield 'empty list without API key' => [[], [$default], null];
|
||||
@@ -147,7 +149,8 @@ class DomainServiceTest extends TestCase
|
||||
public function getOrCreateThrowsExceptionForApiKeysWithDomainRole(): void
|
||||
{
|
||||
$authority = 'example.com';
|
||||
$domain = Domain::withAuthority($authority)->setId('1');
|
||||
$domain = Domain::withAuthority($authority);
|
||||
$domain->setId('1');
|
||||
$apiKey = ApiKey::fromMeta(ApiKeyMeta::withRoles(RoleDefinition::forDomain($domain)));
|
||||
$repo = $this->createMock(DomainRepositoryInterface::class);
|
||||
$repo->method('findOneByAuthority')->with($authority, $apiKey)->willReturn(null);
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace ShlinkioTest\Shlink\Core\Visit\Geolocation;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException;
|
||||
@@ -19,10 +18,8 @@ use Shlinkio\Shlink\Core\Visit\Model\Visitor;
|
||||
use Shlinkio\Shlink\Core\Visit\Repository\VisitRepositoryInterface;
|
||||
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
||||
|
||||
use function array_shift;
|
||||
use function count;
|
||||
use function floor;
|
||||
use function func_get_args;
|
||||
use function Functional\map;
|
||||
use function range;
|
||||
use function sprintf;
|
||||
@@ -72,10 +69,6 @@ class VisitLocatorTest extends TestCase
|
||||
|
||||
public function onVisitLocated(VisitLocation $visitLocation, Visit $visit): void
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
Assert::assertInstanceOf(VisitLocation::class, array_shift($args));
|
||||
Assert::assertInstanceOf(Visit::class, array_shift($args));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ class NonOrphanVisitsPaginatorAdapterTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int<0, max> $limit
|
||||
* @param int<0, max> $offset
|
||||
* @test
|
||||
* @dataProvider provideLimitAndOffset
|
||||
*/
|
||||
|
||||
@@ -41,6 +41,8 @@ class OrphanVisitsPaginatorAdapterTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int<0, max> $limit
|
||||
* @param int<0, max> $offset
|
||||
* @test
|
||||
* @dataProvider provideLimitAndOffset
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user