Updated dependencies

This commit is contained in:
Alejandro Celaya
2020-11-02 11:50:19 +01:00
parent ae636aef5a
commit 1621f3a943
76 changed files with 248 additions and 37 deletions

View File

@@ -66,12 +66,13 @@
"devster/ubench": "^2.0", "devster/ubench": "^2.0",
"dms/phpunit-arraysubset-asserts": "^0.2.0", "dms/phpunit-arraysubset-asserts": "^0.2.0",
"eaglewu/swoole-ide-helper": "dev-master", "eaglewu/swoole-ide-helper": "dev-master",
"infection/infection": "^0.17.7", "infection/infection": "^0.20.0",
"phpstan/phpstan": "^0.12.50", "phpspec/prophecy-phpunit": "^2.0",
"phpunit/php-code-coverage": "^8.0", "phpstan/phpstan": "^0.12.52",
"phpunit/phpunit": "~9.0.1", "phpunit/php-code-coverage": "^9.2",
"phpunit/phpunit": "^9.4",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.1.0", "shlinkio/php-coding-standard": "~2.1.1",
"shlinkio/shlink-test-utils": "^1.5", "shlinkio/shlink-test-utils": "^1.5",
"symfony/var-dumper": "^5.1" "symfony/var-dumper": "^5.1"
}, },

View File

@@ -12,6 +12,8 @@ use Laminas\Stdlib\Glob;
use PDO; use PDO;
use PHPUnit\Runner\Version; use PHPUnit\Runner\Version;
use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Selector;
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\Report\PHP; use SebastianBergmann\CodeCoverage\Report\PHP;
use SebastianBergmann\CodeCoverage\Report\Xml\Facade as Xml; use SebastianBergmann\CodeCoverage\Report\Xml\Facade as Xml;
@@ -25,10 +27,11 @@ use const ShlinkioTest\Shlink\SWOOLE_TESTING_PORT;
$isApiTest = env('TEST_ENV') === 'api'; $isApiTest = env('TEST_ENV') === 'api';
if ($isApiTest) { if ($isApiTest) {
$coverage = new CodeCoverage(); $filter = new Filter();
foreach (Glob::glob(__DIR__ . '/../../module/*/src') as $item) { foreach (Glob::glob(__DIR__ . '/../../module/*/src') as $item) {
$coverage->filter()->addDirectoryToWhitelist($item); $filter->includeDirectory($item);
} }
$coverage = new CodeCoverage((new Selector())->forLineCoverage($filter), $filter);
} }
$buildDbConnection = function (): array { $buildDbConnection = function (): array {

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Api; namespace ShlinkioTest\Shlink\CLI\Command\Api;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Api\DisableKeyCommand; use Shlinkio\Shlink\CLI\Command\Api\DisableKeyCommand;
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException; use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
@@ -14,6 +15,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class DisableKeyCommandTest extends TestCase class DisableKeyCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $apiKeyService; private ObjectProphecy $apiKeyService;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\CLI\Command\Api;
use Cake\Chronos\Chronos; use Cake\Chronos\Chronos;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Api\GenerateKeyCommand; use Shlinkio\Shlink\CLI\Command\Api\GenerateKeyCommand;
use Shlinkio\Shlink\Rest\Entity\ApiKey; use Shlinkio\Shlink\Rest\Entity\ApiKey;
@@ -16,6 +17,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class GenerateKeyCommandTest extends TestCase class GenerateKeyCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $apiKeyService; private ObjectProphecy $apiKeyService;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Api; namespace ShlinkioTest\Shlink\CLI\Command\Api;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Api\ListKeysCommand; use Shlinkio\Shlink\CLI\Command\Api\ListKeysCommand;
use Shlinkio\Shlink\Rest\Entity\ApiKey; use Shlinkio\Shlink\Rest\Entity\ApiKey;
@@ -14,6 +15,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class ListKeysCommandTest extends TestCase class ListKeysCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $apiKeyService; private ObjectProphecy $apiKeyService;

View File

@@ -9,6 +9,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\AbstractSchemaManager;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Db\CreateDatabaseCommand; use Shlinkio\Shlink\CLI\Command\Db\CreateDatabaseCommand;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
@@ -22,10 +23,11 @@ use Symfony\Component\Process\Process;
class CreateDatabaseCommandTest extends TestCase class CreateDatabaseCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $processHelper; private ObjectProphecy $processHelper;
private ObjectProphecy $regularConn; private ObjectProphecy $regularConn;
private ObjectProphecy $noDbNameConn;
private ObjectProphecy $schemaManager; private ObjectProphecy $schemaManager;
private ObjectProphecy $databasePlatform; private ObjectProphecy $databasePlatform;
@@ -48,15 +50,15 @@ class CreateDatabaseCommandTest extends TestCase
$this->regularConn = $this->prophesize(Connection::class); $this->regularConn = $this->prophesize(Connection::class);
$this->regularConn->getSchemaManager()->willReturn($this->schemaManager->reveal()); $this->regularConn->getSchemaManager()->willReturn($this->schemaManager->reveal());
$this->regularConn->getDatabasePlatform()->willReturn($this->databasePlatform->reveal()); $this->regularConn->getDatabasePlatform()->willReturn($this->databasePlatform->reveal());
$this->noDbNameConn = $this->prophesize(Connection::class); $noDbNameConn = $this->prophesize(Connection::class);
$this->noDbNameConn->getSchemaManager()->willReturn($this->schemaManager->reveal()); $noDbNameConn->getSchemaManager()->willReturn($this->schemaManager->reveal());
$command = new CreateDatabaseCommand( $command = new CreateDatabaseCommand(
$locker->reveal(), $locker->reveal(),
$this->processHelper->reveal(), $this->processHelper->reveal(),
$phpExecutableFinder->reveal(), $phpExecutableFinder->reveal(),
$this->regularConn->reveal(), $this->regularConn->reveal(),
$this->noDbNameConn->reveal(), $noDbNameConn->reveal(),
); );
$app = new Application(); $app = new Application();
$app->add($command); $app->add($command);

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\CLI\Command\Db;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Db\MigrateDatabaseCommand; use Shlinkio\Shlink\CLI\Command\Db\MigrateDatabaseCommand;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
@@ -19,6 +20,8 @@ use Symfony\Component\Process\Process;
class MigrateDatabaseCommandTest extends TestCase class MigrateDatabaseCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $processHelper; private ObjectProphecy $processHelper;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Domain; namespace ShlinkioTest\Shlink\CLI\Command\Domain;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Domain\ListDomainsCommand; use Shlinkio\Shlink\CLI\Command\Domain\ListDomainsCommand;
use Shlinkio\Shlink\CLI\Util\ExitCodes; use Shlinkio\Shlink\CLI\Util\ExitCodes;
@@ -15,6 +16,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class ListDomainsCommandTest extends TestCase class ListDomainsCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $domainService; private ObjectProphecy $domainService;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\ShortUrl\DeleteShortUrlCommand; use Shlinkio\Shlink\CLI\Command\ShortUrl\DeleteShortUrlCommand;
use Shlinkio\Shlink\Core\Exception; use Shlinkio\Shlink\Core\Exception;
@@ -21,6 +22,8 @@ use const PHP_EOL;
class DeleteShortUrlCommandTest extends TestCase class DeleteShortUrlCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $service; private ObjectProphecy $service;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\ShortUrl\GenerateShortUrlCommand; use Shlinkio\Shlink\CLI\Command\ShortUrl\GenerateShortUrlCommand;
use Shlinkio\Shlink\CLI\Util\ExitCodes; use Shlinkio\Shlink\CLI\Util\ExitCodes;
@@ -20,6 +21,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class GenerateShortUrlCommandTest extends TestCase class GenerateShortUrlCommandTest extends TestCase
{ {
use ProphecyTrait;
private const DOMAIN_CONFIG = [ private const DOMAIN_CONFIG = [
'schema' => 'http', 'schema' => 'http',
'hostname' => 'foo.com', 'hostname' => 'foo.com',

View File

@@ -9,6 +9,7 @@ use Laminas\Paginator\Adapter\ArrayAdapter;
use Laminas\Paginator\Paginator; use Laminas\Paginator\Paginator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\ShortUrl\GetVisitsCommand; use Shlinkio\Shlink\CLI\Command\ShortUrl\GetVisitsCommand;
use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Common\Util\DateRange;
@@ -27,6 +28,8 @@ use function sprintf;
class GetVisitsCommandTest extends TestCase class GetVisitsCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $visitsTracker; private ObjectProphecy $visitsTracker;

View File

@@ -9,6 +9,7 @@ use Laminas\Paginator\Adapter\ArrayAdapter;
use Laminas\Paginator\Paginator; use Laminas\Paginator\Paginator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\ShortUrl\ListShortUrlsCommand; use Shlinkio\Shlink\CLI\Command\ShortUrl\ListShortUrlsCommand;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -21,6 +22,8 @@ use function explode;
class ListShortUrlsCommandTest extends TestCase class ListShortUrlsCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $shortUrlService; private ObjectProphecy $shortUrlService;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl; namespace ShlinkioTest\Shlink\CLI\Command\ShortUrl;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\ShortUrl\ResolveUrlCommand; use Shlinkio\Shlink\CLI\Command\ShortUrl\ResolveUrlCommand;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -20,6 +21,8 @@ use const PHP_EOL;
class ResolveUrlCommandTest extends TestCase class ResolveUrlCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Tag\CreateTagCommand; use Shlinkio\Shlink\CLI\Command\Tag\CreateTagCommand;
use Shlinkio\Shlink\Core\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Tag\TagServiceInterface;
@@ -14,6 +15,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class CreateTagCommandTest extends TestCase class CreateTagCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Tag\DeleteTagsCommand; use Shlinkio\Shlink\CLI\Command\Tag\DeleteTagsCommand;
use Shlinkio\Shlink\Core\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Tag\TagServiceInterface;
@@ -13,6 +14,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class DeleteTagsCommandTest extends TestCase class DeleteTagsCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand; use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
@@ -15,6 +16,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class ListTagsCommandTest extends TestCase class ListTagsCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\CLI\Command\Tag; namespace ShlinkioTest\Shlink\CLI\Command\Tag;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Tag\RenameTagCommand; use Shlinkio\Shlink\CLI\Command\Tag\RenameTagCommand;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
@@ -15,6 +16,8 @@ use Symfony\Component\Console\Tester\CommandTester;
class RenameTagCommandTest extends TestCase class RenameTagCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\CLI\Command\Visit;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Visit\LocateVisitsCommand; use Shlinkio\Shlink\CLI\Command\Visit\LocateVisitsCommand;
use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException;
@@ -32,10 +33,11 @@ use const PHP_EOL;
class LocateVisitsCommandTest extends TestCase class LocateVisitsCommandTest extends TestCase
{ {
use ProphecyTrait;
private CommandTester $commandTester; private CommandTester $commandTester;
private ObjectProphecy $visitService; private ObjectProphecy $visitService;
private ObjectProphecy $ipResolver; private ObjectProphecy $ipResolver;
private ObjectProphecy $locker;
private ObjectProphecy $lock; private ObjectProphecy $lock;
private ObjectProphecy $dbUpdater; private ObjectProphecy $dbUpdater;
@@ -45,17 +47,17 @@ class LocateVisitsCommandTest extends TestCase
$this->ipResolver = $this->prophesize(IpLocationResolverInterface::class); $this->ipResolver = $this->prophesize(IpLocationResolverInterface::class);
$this->dbUpdater = $this->prophesize(GeolocationDbUpdaterInterface::class); $this->dbUpdater = $this->prophesize(GeolocationDbUpdaterInterface::class);
$this->locker = $this->prophesize(Lock\LockFactory::class); $locker = $this->prophesize(Lock\LockFactory::class);
$this->lock = $this->prophesize(Lock\LockInterface::class); $this->lock = $this->prophesize(Lock\LockInterface::class);
$this->lock->acquire(false)->willReturn(true); $this->lock->acquire(false)->willReturn(true);
$this->lock->release()->will(function (): void { $this->lock->release()->will(function (): void {
}); });
$this->locker->createLock(Argument::type('string'), 90.0, false)->willReturn($this->lock->reveal()); $locker->createLock(Argument::type('string'), 90.0, false)->willReturn($this->lock->reveal());
$command = new LocateVisitsCommand( $command = new LocateVisitsCommand(
$this->visitService->reveal(), $this->visitService->reveal(),
$this->ipResolver->reveal(), $this->ipResolver->reveal(),
$this->locker->reveal(), $locker->reveal(),
$this->dbUpdater->reveal(), $this->dbUpdater->reveal(),
); );
$app = new Application(); $app = new Application();

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\CLI\Factory;
use Laminas\ServiceManager\ServiceManager; use Laminas\ServiceManager\ServiceManager;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Factory\ApplicationFactory; use Shlinkio\Shlink\CLI\Factory\ApplicationFactory;
use Shlinkio\Shlink\Core\Options\AppOptions; use Shlinkio\Shlink\Core\Options\AppOptions;
@@ -15,6 +16,8 @@ use Symfony\Component\Console\Command\Command;
class ApplicationFactoryTest extends TestCase class ApplicationFactoryTest extends TestCase
{ {
use ProphecyTrait;
private ApplicationFactory $factory; private ApplicationFactory $factory;
public function setUp(): void public function setUp(): void

View File

@@ -9,6 +9,7 @@ use GeoIp2\Database\Reader;
use MaxMind\Db\Reader\Metadata; use MaxMind\Db\Reader\Metadata;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException; use Shlinkio\Shlink\CLI\Exception\GeolocationDbUpdateFailedException;
use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdater; use Shlinkio\Shlink\CLI\Util\GeolocationDbUpdater;
@@ -22,28 +23,28 @@ use function range;
class GeolocationDbUpdaterTest extends TestCase class GeolocationDbUpdaterTest extends TestCase
{ {
use ProphecyTrait;
private GeolocationDbUpdater $geolocationDbUpdater; private GeolocationDbUpdater $geolocationDbUpdater;
private ObjectProphecy $dbUpdater; private ObjectProphecy $dbUpdater;
private ObjectProphecy $geoLiteDbReader; private ObjectProphecy $geoLiteDbReader;
private ObjectProphecy $locker;
private ObjectProphecy $lock;
public function setUp(): void public function setUp(): void
{ {
$this->dbUpdater = $this->prophesize(DbUpdaterInterface::class); $this->dbUpdater = $this->prophesize(DbUpdaterInterface::class);
$this->geoLiteDbReader = $this->prophesize(Reader::class); $this->geoLiteDbReader = $this->prophesize(Reader::class);
$this->locker = $this->prophesize(Lock\LockFactory::class); $locker = $this->prophesize(Lock\LockFactory::class);
$this->lock = $this->prophesize(Lock\LockInterface::class); $lock = $this->prophesize(Lock\LockInterface::class);
$this->lock->acquire(true)->willReturn(true); $lock->acquire(true)->willReturn(true);
$this->lock->release()->will(function (): void { $lock->release()->will(function (): void {
}); });
$this->locker->createLock(Argument::type('string'))->willReturn($this->lock->reveal()); $locker->createLock(Argument::type('string'))->willReturn($lock->reveal());
$this->geolocationDbUpdater = new GeolocationDbUpdater( $this->geolocationDbUpdater = new GeolocationDbUpdater(
$this->dbUpdater->reveal(), $this->dbUpdater->reveal(),
$this->geoLiteDbReader->reveal(), $this->geoLiteDbReader->reveal(),
$this->locker->reveal(), $locker->reveal(),
); );
} }

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\CLI\Util;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use ReflectionObject; use ReflectionObject;
use Shlinkio\Shlink\CLI\Util\ShlinkTable; use Shlinkio\Shlink\CLI\Util\ShlinkTable;
@@ -15,6 +16,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class ShlinkTableTest extends TestCase class ShlinkTableTest extends TestCase
{ {
use ProphecyTrait;
private ShlinkTable $shlinkTable; private ShlinkTable $shlinkTable;
private ObjectProphecy $baseTable; private ObjectProphecy $baseTable;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Core\Action;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Common\Response\PixelResponse; use Shlinkio\Shlink\Common\Response\PixelResponse;
@@ -19,6 +20,8 @@ use Shlinkio\Shlink\Core\Service\VisitsTracker;
class PixelActionTest extends TestCase class PixelActionTest extends TestCase
{ {
use ProphecyTrait;
private PixelAction $action; private PixelAction $action;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;
private ObjectProphecy $visitTracker; private ObjectProphecy $visitTracker;

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\ServerRequest;
use Mezzio\Router\RouterInterface; use Mezzio\Router\RouterInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Common\Response\QrCodeResponse; use Shlinkio\Shlink\Common\Response\QrCodeResponse;
@@ -20,6 +21,8 @@ use Shlinkio\Shlink\Core\Service\ShortUrl\ShortUrlResolverInterface;
class QrCodeActionTest extends TestCase class QrCodeActionTest extends TestCase
{ {
use ProphecyTrait;
private QrCodeAction $action; private QrCodeAction $action;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;

View File

@@ -10,6 +10,7 @@ use Laminas\Diactoros\ServerRequest;
use Mezzio\Router\Middleware\ImplicitHeadMiddleware; use Mezzio\Router\Middleware\ImplicitHeadMiddleware;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Action\RedirectAction; use Shlinkio\Shlink\Core\Action\RedirectAction;
@@ -24,6 +25,8 @@ use function array_key_exists;
class RedirectActionTest extends TestCase class RedirectActionTest extends TestCase
{ {
use ProphecyTrait;
private RedirectAction $action; private RedirectAction $action;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;
private ObjectProphecy $visitTracker; private ObjectProphecy $visitTracker;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Core\Domain;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Domain\DomainService; use Shlinkio\Shlink\Core\Domain\DomainService;
use Shlinkio\Shlink\Core\Domain\Repository\DomainRepositoryInterface; use Shlinkio\Shlink\Core\Domain\Repository\DomainRepositoryInterface;
@@ -13,6 +14,8 @@ use Shlinkio\Shlink\Core\Entity\Domain;
class DomainServiceTest extends TestCase class DomainServiceTest extends TestCase
{ {
use ProphecyTrait;
private DomainService $domainService; private DomainService $domainService;
private ObjectProphecy $em; private ObjectProphecy $em;

View File

@@ -7,12 +7,15 @@ namespace ShlinkioTest\Shlink\Core\Domain\Resolver;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectRepository; use Doctrine\Persistence\ObjectRepository;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Domain\Resolver\PersistenceDomainResolver; use Shlinkio\Shlink\Core\Domain\Resolver\PersistenceDomainResolver;
use Shlinkio\Shlink\Core\Entity\Domain; use Shlinkio\Shlink\Core\Entity\Domain;
class PersistenceDomainResolverTest extends TestCase class PersistenceDomainResolverTest extends TestCase
{ {
use ProphecyTrait;
private PersistenceDomainResolver $domainResolver; private PersistenceDomainResolver $domainResolver;
private ObjectProphecy $em; private ObjectProphecy $em;

View File

@@ -10,6 +10,7 @@ use Laminas\Diactoros\Uri;
use Mezzio\Router\Route; use Mezzio\Router\Route;
use Mezzio\Router\RouteResult; use Mezzio\Router\RouteResult;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
@@ -19,6 +20,8 @@ use Shlinkio\Shlink\Core\Options\NotFoundRedirectOptions;
class NotFoundRedirectHandlerTest extends TestCase class NotFoundRedirectHandlerTest extends TestCase
{ {
use ProphecyTrait;
private NotFoundRedirectHandler $middleware; private NotFoundRedirectHandler $middleware;
private NotFoundRedirectOptions $redirectOptions; private NotFoundRedirectOptions $redirectOptions;

View File

@@ -10,6 +10,7 @@ use Mezzio\Router\Route;
use Mezzio\Router\RouteResult; use Mezzio\Router\RouteResult;
use Mezzio\Template\TemplateRendererInterface; use Mezzio\Template\TemplateRendererInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\MiddlewareInterface;
@@ -17,6 +18,8 @@ use Shlinkio\Shlink\Core\ErrorHandler\NotFoundTemplateHandler;
class NotFoundTemplateHandlerTest extends TestCase class NotFoundTemplateHandlerTest extends TestCase
{ {
use ProphecyTrait;
private NotFoundTemplateHandler $handler; private NotFoundTemplateHandler $handler;
private ObjectProphecy $renderer; private ObjectProphecy $renderer;

View File

@@ -2,9 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace ShlinkioTest\Shlink\Rest\EventDispatcher; namespace ShlinkioTest\Shlink\Core\EventDispatcher;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Shlinkio\Shlink\Common\Doctrine\ReopeningEntityManagerInterface; use Shlinkio\Shlink\Common\Doctrine\ReopeningEntityManagerInterface;
@@ -12,6 +13,8 @@ use Shlinkio\Shlink\Core\EventDispatcher\CloseDbConnectionEventListenerDelegator
class CloseDbConnectionEventListenerDelegatorTest extends TestCase class CloseDbConnectionEventListenerDelegatorTest extends TestCase
{ {
use ProphecyTrait;
private CloseDbConnectionEventListenerDelegator $delegator; private CloseDbConnectionEventListenerDelegator $delegator;
private ObjectProphecy $container; private ObjectProphecy $container;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Core\EventDispatcher;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use RuntimeException; use RuntimeException;
use Shlinkio\Shlink\Common\Doctrine\ReopeningEntityManagerInterface; use Shlinkio\Shlink\Common\Doctrine\ReopeningEntityManagerInterface;
@@ -15,6 +16,8 @@ use Throwable;
class CloseDbConnectionEventListenerTest extends TestCase class CloseDbConnectionEventListenerTest extends TestCase
{ {
use ProphecyTrait;
private ObjectProphecy $em; private ObjectProphecy $em;
public function setUp(): void public function setUp(): void

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Core\EventDispatcher;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\EventDispatcher\EventDispatcherInterface; use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@@ -26,6 +27,8 @@ use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
class LocateShortUrlVisitTest extends TestCase class LocateShortUrlVisitTest extends TestCase
{ {
use ProphecyTrait;
private LocateShortUrlVisit $locateVisit; private LocateShortUrlVisit $locateVisit;
private ObjectProphecy $ipLocationResolver; private ObjectProphecy $ipLocationResolver;
private ObjectProphecy $em; private ObjectProphecy $em;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Core\EventDispatcher;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use RuntimeException; use RuntimeException;
@@ -21,6 +22,8 @@ use Symfony\Component\Mercure\Update;
class NotifyVisitToMercureTest extends TestCase class NotifyVisitToMercureTest extends TestCase
{ {
use ProphecyTrait;
private NotifyVisitToMercure $listener; private NotifyVisitToMercure $listener;
private ObjectProphecy $publisher; private ObjectProphecy $publisher;
private ObjectProphecy $updatesGenerator; private ObjectProphecy $updatesGenerator;

View File

@@ -14,6 +14,7 @@ use GuzzleHttp\RequestOptions;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -28,6 +29,8 @@ use function Functional\contains;
class NotifyVisitToWebHooksTest extends TestCase class NotifyVisitToWebHooksTest extends TestCase
{ {
use ProphecyTrait;
private ObjectProphecy $httpClient; private ObjectProphecy $httpClient;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $logger; private ObjectProphecy $logger;

View File

@@ -8,6 +8,7 @@ use Fig\Http\Message\StatusCodeInterface;
use Laminas\InputFilter\InputFilterInterface; use Laminas\InputFilter\InputFilterInterface;
use LogicException; use LogicException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use RuntimeException; use RuntimeException;
use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Exception\ValidationException;
use Throwable; use Throwable;
@@ -17,6 +18,8 @@ use function print_r;
class ValidationExceptionTest extends TestCase class ValidationExceptionTest extends TestCase
{ {
use ProphecyTrait;
/** /**
* @test * @test
* @dataProvider provideExceptions * @dataProvider provideExceptions

View File

@@ -8,6 +8,7 @@ use Cake\Chronos\Chronos;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Domain\Resolver\SimpleDomainResolver; use Shlinkio\Shlink\Core\Domain\Resolver\SimpleDomainResolver;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -25,6 +26,8 @@ use function str_contains;
class ImportedLinksProcessorTest extends TestCase class ImportedLinksProcessorTest extends TestCase
{ {
use ProphecyTrait;
private ImportedLinksProcessor $processor; private ImportedLinksProcessor $processor;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $shortCodeHelper; private ObjectProphecy $shortCodeHelper;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Core\Paginator\Adapter;
use Cake\Chronos\Chronos; use Cake\Chronos\Chronos;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Model\ShortUrlsParams; use Shlinkio\Shlink\Core\Model\ShortUrlsParams;
use Shlinkio\Shlink\Core\Paginator\Adapter\ShortUrlRepositoryAdapter; use Shlinkio\Shlink\Core\Paginator\Adapter\ShortUrlRepositoryAdapter;
@@ -13,6 +14,8 @@ use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
class ShortUrlRepositoryAdapterTest extends TestCase class ShortUrlRepositoryAdapterTest extends TestCase
{ {
use ProphecyTrait;
private ObjectProphecy $repo; private ObjectProphecy $repo;
public function setUp(): void public function setUp(): void

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Core\Paginator\Adapter; namespace ShlinkioTest\Shlink\Core\Paginator\Adapter;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Model\VisitsParams; use Shlinkio\Shlink\Core\Model\VisitsParams;
@@ -13,6 +14,8 @@ use Shlinkio\Shlink\Core\Repository\VisitRepositoryInterface;
class VisitsForTagPaginatorAdapterTest extends TestCase class VisitsForTagPaginatorAdapterTest extends TestCase
{ {
use ProphecyTrait;
private VisitsForTagPaginatorAdapter $adapter; private VisitsForTagPaginatorAdapter $adapter;
private ObjectProphecy $repo; private ObjectProphecy $repo;

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Core\Paginator\Adapter; namespace ShlinkioTest\Shlink\Core\Paginator\Adapter;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
@@ -14,6 +15,8 @@ use Shlinkio\Shlink\Core\Repository\VisitRepositoryInterface;
class VisitsPaginatorAdapterTest extends TestCase class VisitsPaginatorAdapterTest extends TestCase
{ {
use ProphecyTrait;
private VisitsPaginatorAdapter $adapter; private VisitsPaginatorAdapter $adapter;
private ObjectProphecy $repo; private ObjectProphecy $repo;

View File

@@ -8,6 +8,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\Visit;
@@ -24,6 +25,8 @@ use function sprintf;
class DeleteShortUrlServiceTest extends TestCase class DeleteShortUrlServiceTest extends TestCase
{ {
use ProphecyTrait;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;
private string $shortCode; private string $shortCode;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Core\Service\ShortUrl;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\Domain; use Shlinkio\Shlink\Core\Entity\Domain;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -14,6 +15,8 @@ use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeHelper;
class ShortCodeHelperTest extends TestCase class ShortCodeHelperTest extends TestCase
{ {
use ProphecyTrait;
private ShortCodeHelper $helper; private ShortCodeHelper $helper;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $shortUrl; private ObjectProphecy $shortUrl;

View File

@@ -8,6 +8,7 @@ use Cake\Chronos\Chronos;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\Visit;
@@ -23,6 +24,8 @@ use function range;
class ShortUrlResolverTest extends TestCase class ShortUrlResolverTest extends TestCase
{ {
use ProphecyTrait;
private ShortUrlResolver $urlResolver; private ShortUrlResolver $urlResolver;
private ObjectProphecy $em; private ObjectProphecy $em;

View File

@@ -9,6 +9,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
@@ -24,6 +25,8 @@ use function count;
class ShortUrlServiceTest extends TestCase class ShortUrlServiceTest extends TestCase
{ {
use ProphecyTrait;
private ShortUrlService $service; private ShortUrlService $service;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Core\Service\Tag;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
use Shlinkio\Shlink\Core\Exception\TagConflictException; use Shlinkio\Shlink\Core\Exception\TagConflictException;
@@ -17,6 +18,8 @@ use Shlinkio\Shlink\Core\Tag\TagService;
class TagServiceTest extends TestCase class TagServiceTest extends TestCase
{ {
use ProphecyTrait;
private TagService $service; private TagService $service;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $repo; private ObjectProphecy $repo;

View File

@@ -11,6 +11,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Domain\Resolver\SimpleDomainResolver; use Shlinkio\Shlink\Core\Domain\Resolver\SimpleDomainResolver;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -24,6 +25,8 @@ use Shlinkio\Shlink\Core\Util\UrlValidatorInterface;
class UrlShortenerTest extends TestCase class UrlShortenerTest extends TestCase
{ {
use ProphecyTrait;
private UrlShortener $urlShortener; private UrlShortener $urlShortener;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $urlValidator; private ObjectProphecy $urlValidator;

View File

@@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManager;
use Laminas\Stdlib\ArrayUtils; use Laminas\Stdlib\ArrayUtils;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\EventDispatcher\EventDispatcherInterface; use Psr\EventDispatcher\EventDispatcherInterface;
use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Common\Util\DateRange;
@@ -30,6 +31,8 @@ use function range;
class VisitsTrackerTest extends TestCase class VisitsTrackerTest extends TestCase
{ {
use ProphecyTrait;
private VisitsTracker $visitsTracker; private VisitsTracker $visitsTracker;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $eventDispatcher; private ObjectProphecy $eventDispatcher;

View File

@@ -6,12 +6,15 @@ namespace ShlinkioTest\Shlink\Core\Util;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use RuntimeException; use RuntimeException;
use Shlinkio\Shlink\Core\Util\DoctrineBatchHelper; use Shlinkio\Shlink\Core\Util\DoctrineBatchHelper;
class DoctrineBatchHelperTest extends TestCase class DoctrineBatchHelperTest extends TestCase
{ {
use ProphecyTrait;
private DoctrineBatchHelper $helper; private DoctrineBatchHelper $helper;
private ObjectProphecy $em; private ObjectProphecy $em;

View File

@@ -11,6 +11,7 @@ use GuzzleHttp\RequestOptions;
use Laminas\Diactoros\Response; use Laminas\Diactoros\Response;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Exception\InvalidUrlException; use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions; use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
@@ -18,6 +19,8 @@ use Shlinkio\Shlink\Core\Util\UrlValidator;
class UrlValidatorTest extends TestCase class UrlValidatorTest extends TestCase
{ {
use ProphecyTrait;
private UrlValidator $urlValidator; private UrlValidator $urlValidator;
private ObjectProphecy $httpClient; private ObjectProphecy $httpClient;
private UrlShortenerOptions $options; private UrlShortenerOptions $options;

View File

@@ -9,6 +9,7 @@ use Exception;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -31,6 +32,8 @@ use function sprintf;
class VisitLocatorTest extends TestCase class VisitLocatorTest extends TestCase
{ {
use ProphecyTrait;
private VisitLocator $visitService; private VisitLocator $visitService;
private ObjectProphecy $em; private ObjectProphecy $em;
private ObjectProphecy $repo; private ObjectProphecy $repo;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Core\Visit;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\Visit; use Shlinkio\Shlink\Core\Entity\Visit;
use Shlinkio\Shlink\Core\Repository\VisitRepository; use Shlinkio\Shlink\Core\Repository\VisitRepository;
@@ -17,6 +18,8 @@ use function range;
class VisitsStatsHelperTest extends TestCase class VisitsStatsHelperTest extends TestCase
{ {
use ProphecyTrait;
private VisitsStatsHelper $helper; private VisitsStatsHelper $helper;
private ObjectProphecy $em; private ObjectProphecy $em;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Domain;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Laminas\Diactoros\ServerRequestFactory; use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Domain\DomainServiceInterface; use Shlinkio\Shlink\Core\Domain\DomainServiceInterface;
use Shlinkio\Shlink\Core\Entity\Domain; use Shlinkio\Shlink\Core\Entity\Domain;
@@ -14,6 +15,8 @@ use Shlinkio\Shlink\Rest\Action\Domain\ListDomainsAction;
class ListDomainsActionTest extends TestCase class ListDomainsActionTest extends TestCase
{ {
use ProphecyTrait;
private ListDomainsAction $action; private ListDomainsAction $action;
private ObjectProphecy $domainService; private ObjectProphecy $domainService;

View File

@@ -10,12 +10,15 @@ use Exception;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Options\AppOptions; use Shlinkio\Shlink\Core\Options\AppOptions;
use Shlinkio\Shlink\Rest\Action\HealthAction; use Shlinkio\Shlink\Rest\Action\HealthAction;
class HealthActionTest extends TestCase class HealthActionTest extends TestCase
{ {
use ProphecyTrait;
private HealthAction $action; private HealthAction $action;
private ObjectProphecy $conn; private ObjectProphecy $conn;

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\Response\JsonResponse;
use Laminas\Diactoros\ServerRequestFactory; use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use RuntimeException; use RuntimeException;
use Shlinkio\Shlink\Common\Mercure\JwtProviderInterface; use Shlinkio\Shlink\Common\Mercure\JwtProviderInterface;
@@ -17,6 +18,8 @@ use Shlinkio\Shlink\Rest\Exception\MercureException;
class MercureInfoActionTest extends TestCase class MercureInfoActionTest extends TestCase
{ {
use ProphecyTrait;
private ObjectProphecy $provider; private ObjectProphecy $provider;
public function setUp(): void public function setUp(): void

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\ServerRequest;
use Laminas\Diactoros\ServerRequestFactory; use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Exception\ValidationException;
@@ -20,6 +21,8 @@ use function strpos;
class CreateShortUrlActionTest extends TestCase class CreateShortUrlActionTest extends TestCase
{ {
use ProphecyTrait;
private const DOMAIN_CONFIG = [ private const DOMAIN_CONFIG = [
'schema' => 'http', 'schema' => 'http',
'hostname' => 'foo.com', 'hostname' => 'foo.com',

View File

@@ -7,12 +7,15 @@ namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface; use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
use Shlinkio\Shlink\Rest\Action\ShortUrl\DeleteShortUrlAction; use Shlinkio\Shlink\Rest\Action\ShortUrl\DeleteShortUrlAction;
class DeleteShortUrlActionTest extends TestCase class DeleteShortUrlActionTest extends TestCase
{ {
use ProphecyTrait;
private DeleteShortUrlAction $action; private DeleteShortUrlAction $action;
private ObjectProphecy $service; private ObjectProphecy $service;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Exception\ValidationException;
@@ -15,6 +16,8 @@ use Shlinkio\Shlink\Rest\Action\ShortUrl\EditShortUrlAction;
class EditShortUrlActionTest extends TestCase class EditShortUrlActionTest extends TestCase
{ {
use ProphecyTrait;
private EditShortUrlAction $action; private EditShortUrlAction $action;
private ObjectProphecy $shortUrlService; private ObjectProphecy $shortUrlService;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Exception\ValidationException;
@@ -15,6 +16,8 @@ use Shlinkio\Shlink\Rest\Action\ShortUrl\EditShortUrlTagsAction;
class EditShortUrlTagsActionTest extends TestCase class EditShortUrlTagsActionTest extends TestCase
{ {
use ProphecyTrait;
private EditShortUrlTagsAction $action; private EditShortUrlTagsAction $action;
private ObjectProphecy $shortUrlService; private ObjectProphecy $shortUrlService;

View File

@@ -10,27 +10,27 @@ use Laminas\Diactoros\ServerRequest;
use Laminas\Paginator\Adapter\ArrayAdapter; use Laminas\Paginator\Adapter\ArrayAdapter;
use Laminas\Paginator\Paginator; use Laminas\Paginator\Paginator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Core\Model\ShortUrlsParams; use Shlinkio\Shlink\Core\Model\ShortUrlsParams;
use Shlinkio\Shlink\Core\Service\ShortUrlService; use Shlinkio\Shlink\Core\Service\ShortUrlService;
use Shlinkio\Shlink\Rest\Action\ShortUrl\ListShortUrlsAction; use Shlinkio\Shlink\Rest\Action\ShortUrl\ListShortUrlsAction;
class ListShortUrlsActionTest extends TestCase class ListShortUrlsActionTest extends TestCase
{ {
use ProphecyTrait;
private ListShortUrlsAction $action; private ListShortUrlsAction $action;
private ObjectProphecy $service; private ObjectProphecy $service;
private ObjectProphecy $logger;
public function setUp(): void public function setUp(): void
{ {
$this->service = $this->prophesize(ShortUrlService::class); $this->service = $this->prophesize(ShortUrlService::class);
$this->logger = $this->prophesize(LoggerInterface::class);
$this->action = new ListShortUrlsAction($this->service->reveal(), [ $this->action = new ListShortUrlsAction($this->service->reveal(), [
'hostname' => 'doma.in', 'hostname' => 'doma.in',
'schema' => 'https', 'schema' => 'https',
], $this->logger->reveal()); ]);
} }
/** /**

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
@@ -16,6 +17,8 @@ use function strpos;
class ResolveShortUrlActionTest extends TestCase class ResolveShortUrlActionTest extends TestCase
{ {
use ProphecyTrait;
private ResolveShortUrlAction $action; private ResolveShortUrlAction $action;
private ObjectProphecy $urlResolver; private ObjectProphecy $urlResolver;

View File

@@ -8,6 +8,7 @@ use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Exception\ValidationException;
@@ -18,6 +19,8 @@ use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
class SingleStepCreateShortUrlActionTest extends TestCase class SingleStepCreateShortUrlActionTest extends TestCase
{ {
use ProphecyTrait;
private SingleStepCreateShortUrlAction $action; private SingleStepCreateShortUrlAction $action;
private ObjectProphecy $urlShortener; private ObjectProphecy $urlShortener;
private ObjectProphecy $apiKeyService; private ObjectProphecy $apiKeyService;

View File

@@ -7,12 +7,15 @@ namespace ShlinkioTest\Shlink\Rest\Action\Tag;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Tag\TagServiceInterface;
use Shlinkio\Shlink\Rest\Action\Tag\CreateTagsAction; use Shlinkio\Shlink\Rest\Action\Tag\CreateTagsAction;
class CreateTagsActionTest extends TestCase class CreateTagsActionTest extends TestCase
{ {
use ProphecyTrait;
private CreateTagsAction $action; private CreateTagsAction $action;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -6,12 +6,15 @@ namespace ShlinkioTest\Shlink\Rest\Action\Tag;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Tag\TagServiceInterface; use Shlinkio\Shlink\Core\Tag\TagServiceInterface;
use Shlinkio\Shlink\Rest\Action\Tag\DeleteTagsAction; use Shlinkio\Shlink\Rest\Action\Tag\DeleteTagsAction;
class DeleteTagsActionTest extends TestCase class DeleteTagsActionTest extends TestCase
{ {
use ProphecyTrait;
private DeleteTagsAction $action; private DeleteTagsAction $action;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Tag;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Laminas\Diactoros\ServerRequestFactory; use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
use Shlinkio\Shlink\Core\Tag\Model\TagInfo; use Shlinkio\Shlink\Core\Tag\Model\TagInfo;
@@ -15,6 +16,8 @@ use Shlinkio\Shlink\Rest\Action\Tag\ListTagsAction;
class ListTagsActionTest extends TestCase class ListTagsActionTest extends TestCase
{ {
use ProphecyTrait;
private ListTagsAction $action; private ListTagsAction $action;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Tag;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Entity\Tag;
use Shlinkio\Shlink\Core\Exception\ValidationException; use Shlinkio\Shlink\Core\Exception\ValidationException;
@@ -14,6 +15,8 @@ use Shlinkio\Shlink\Rest\Action\Tag\UpdateTagAction;
class UpdateTagActionTest extends TestCase class UpdateTagActionTest extends TestCase
{ {
use ProphecyTrait;
private UpdateTagAction $action; private UpdateTagAction $action;
private ObjectProphecy $tagService; private ObjectProphecy $tagService;

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Laminas\Diactoros\ServerRequestFactory; use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Visit\Model\VisitsStats; use Shlinkio\Shlink\Core\Visit\Model\VisitsStats;
use Shlinkio\Shlink\Core\Visit\VisitsStatsHelperInterface; use Shlinkio\Shlink\Core\Visit\VisitsStatsHelperInterface;
@@ -14,6 +15,8 @@ use Shlinkio\Shlink\Rest\Action\Visit\GlobalVisitsAction;
class GlobalVisitsActionTest extends TestCase class GlobalVisitsActionTest extends TestCase
{ {
use ProphecyTrait;
private GlobalVisitsAction $action; private GlobalVisitsAction $action;
private ObjectProphecy $helper; private ObjectProphecy $helper;

View File

@@ -10,6 +10,7 @@ use Laminas\Paginator\Adapter\ArrayAdapter;
use Laminas\Paginator\Paginator; use Laminas\Paginator\Paginator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier; use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
@@ -19,6 +20,8 @@ use Shlinkio\Shlink\Rest\Action\Visit\ShortUrlVisitsAction;
class ShortUrlVisitsActionTest extends TestCase class ShortUrlVisitsActionTest extends TestCase
{ {
use ProphecyTrait;
private ShortUrlVisitsAction $action; private ShortUrlVisitsAction $action;
private ObjectProphecy $visitsTracker; private ObjectProphecy $visitsTracker;

View File

@@ -9,6 +9,7 @@ use Laminas\Paginator\Adapter\ArrayAdapter;
use Laminas\Paginator\Paginator; use Laminas\Paginator\Paginator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Model\VisitsParams; use Shlinkio\Shlink\Core\Model\VisitsParams;
use Shlinkio\Shlink\Core\Service\VisitsTracker; use Shlinkio\Shlink\Core\Service\VisitsTracker;
@@ -16,6 +17,8 @@ use Shlinkio\Shlink\Rest\Action\Visit\TagVisitsAction;
class TagVisitsActionTest extends TestCase class TagVisitsActionTest extends TestCase
{ {
use ProphecyTrait;
private TagVisitsAction $action; private TagVisitsAction $action;
private ObjectProphecy $visitsTracker; private ObjectProphecy $visitsTracker;

View File

@@ -6,12 +6,15 @@ namespace ShlinkioTest\Shlink\Rest\Authentication;
use Laminas\ServiceManager\ServiceManager; use Laminas\ServiceManager\ServiceManager;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Shlinkio\Shlink\Rest\Authentication\AuthenticationPluginManager; use Shlinkio\Shlink\Rest\Authentication\AuthenticationPluginManager;
use Shlinkio\Shlink\Rest\Authentication\AuthenticationPluginManagerFactory; use Shlinkio\Shlink\Rest\Authentication\AuthenticationPluginManagerFactory;
use Shlinkio\Shlink\Rest\Authentication\Plugin\AuthenticationPluginInterface; use Shlinkio\Shlink\Rest\Authentication\Plugin\AuthenticationPluginInterface;
class AuthenticationPluginManagerFactoryTest extends TestCase class AuthenticationPluginManagerFactoryTest extends TestCase
{ {
use ProphecyTrait;
private AuthenticationPluginManagerFactory $factory; private AuthenticationPluginManagerFactory $factory;
public function setUp(): void public function setUp(): void

View File

@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Authentication\Plugin;
use Laminas\Diactoros\Response; use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Rest\Authentication\Plugin\ApiKeyHeaderPlugin; use Shlinkio\Shlink\Rest\Authentication\Plugin\ApiKeyHeaderPlugin;
@@ -15,6 +16,8 @@ use Shlinkio\Shlink\Rest\Service\ApiKeyServiceInterface;
class ApiKeyHeaderPluginTest extends TestCase class ApiKeyHeaderPluginTest extends TestCase
{ {
use ProphecyTrait;
private ApiKeyHeaderPlugin $plugin; private ApiKeyHeaderPlugin $plugin;
private ObjectProphecy $apiKeyService; private ObjectProphecy $apiKeyService;

View File

@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Authentication;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Rest\Authentication\AuthenticationPluginManagerInterface; use Shlinkio\Shlink\Rest\Authentication\AuthenticationPluginManagerInterface;
use Shlinkio\Shlink\Rest\Authentication\Plugin\ApiKeyHeaderPlugin; use Shlinkio\Shlink\Rest\Authentication\Plugin\ApiKeyHeaderPlugin;
@@ -18,6 +19,8 @@ use function sprintf;
class RequestToAuthPluginTest extends TestCase class RequestToAuthPluginTest extends TestCase
{ {
use ProphecyTrait;
private RequestToHttpAuthPlugin $requestToPlugin; private RequestToHttpAuthPlugin $requestToPlugin;
private ObjectProphecy $pluginManager; private ObjectProphecy $pluginManager;

View File

@@ -11,12 +11,12 @@ use Mezzio\Router\Route;
use Mezzio\Router\RouteResult; use Mezzio\Router\RouteResult;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Psr\Log\LoggerInterface;
use Shlinkio\Shlink\Rest\Action\HealthAction; use Shlinkio\Shlink\Rest\Action\HealthAction;
use Shlinkio\Shlink\Rest\Authentication\Plugin\AuthenticationPluginInterface; use Shlinkio\Shlink\Rest\Authentication\Plugin\AuthenticationPluginInterface;
use Shlinkio\Shlink\Rest\Authentication\RequestToHttpAuthPluginInterface; use Shlinkio\Shlink\Rest\Authentication\RequestToHttpAuthPluginInterface;
@@ -26,20 +26,15 @@ use function Laminas\Stratigility\middleware;
class AuthenticationMiddlewareTest extends TestCase class AuthenticationMiddlewareTest extends TestCase
{ {
use ProphecyTrait;
private AuthenticationMiddleware $middleware; private AuthenticationMiddleware $middleware;
private ObjectProphecy $requestToPlugin; private ObjectProphecy $requestToPlugin;
private ObjectProphecy $logger;
public function setUp(): void public function setUp(): void
{ {
$this->requestToPlugin = $this->prophesize(RequestToHttpAuthPluginInterface::class); $this->requestToPlugin = $this->prophesize(RequestToHttpAuthPluginInterface::class);
$this->logger = $this->prophesize(LoggerInterface::class); $this->middleware = new AuthenticationMiddleware($this->requestToPlugin->reveal(), [HealthAction::class]);
$this->middleware = new AuthenticationMiddleware(
$this->requestToPlugin->reveal(),
[HealthAction::class],
$this->logger->reveal(),
);
} }
/** /**

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\ServerRequest;
use Laminas\Diactoros\Stream; use Laminas\Diactoros\Stream;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ProphecyInterface; use Prophecy\Prophecy\ProphecyInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
@@ -18,6 +19,8 @@ use function array_shift;
class BodyParserMiddlewareTest extends TestCase class BodyParserMiddlewareTest extends TestCase
{ {
use ProphecyTrait;
private BodyParserMiddleware $middleware; private BodyParserMiddleware $middleware;
public function setUp(): void public function setUp(): void

View File

@@ -10,6 +10,7 @@ use Mezzio\Router\Route;
use Mezzio\Router\RouteResult; use Mezzio\Router\RouteResult;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Rest\Authentication; use Shlinkio\Shlink\Rest\Authentication;
@@ -19,6 +20,8 @@ use function Laminas\Stratigility\middleware;
class CrossDomainMiddlewareTest extends TestCase class CrossDomainMiddlewareTest extends TestCase
{ {
use ProphecyTrait;
private CrossDomainMiddleware $middleware; private CrossDomainMiddleware $middleware;
private ObjectProphecy $handler; private ObjectProphecy $handler;

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\Response\JsonResponse;
use Laminas\Diactoros\ServerRequest; use Laminas\Diactoros\ServerRequest;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
@@ -16,6 +17,8 @@ use Shlinkio\Shlink\Rest\Middleware\ShortUrl\CreateShortUrlContentNegotiationMid
class CreateShortUrlContentNegotiationMiddlewareTest extends TestCase class CreateShortUrlContentNegotiationMiddlewareTest extends TestCase
{ {
use ProphecyTrait;
private CreateShortUrlContentNegotiationMiddleware $middleware; private CreateShortUrlContentNegotiationMiddleware $middleware;
private ObjectProphecy $requestHandler; private ObjectProphecy $requestHandler;

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
@@ -17,6 +18,8 @@ use Shlinkio\Shlink\Rest\Middleware\ShortUrl\DefaultShortCodesLengthMiddleware;
class DefaultShortCodesLengthMiddlewareTest extends TestCase class DefaultShortCodesLengthMiddlewareTest extends TestCase
{ {
use ProphecyTrait;
private DefaultShortCodesLengthMiddleware $middleware; private DefaultShortCodesLengthMiddleware $middleware;
private ObjectProphecy $handler; private ObjectProphecy $handler;

View File

@@ -9,6 +9,7 @@ use Laminas\Diactoros\ServerRequestFactory;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
@@ -16,6 +17,8 @@ use Shlinkio\Shlink\Rest\Middleware\ShortUrl\DropDefaultDomainFromRequestMiddlew
class DropDefaultDomainFromRequestMiddlewareTest extends TestCase class DropDefaultDomainFromRequestMiddlewareTest extends TestCase
{ {
use ProphecyTrait;
private DropDefaultDomainFromRequestMiddleware $middleware; private DropDefaultDomainFromRequestMiddleware $middleware;
private ObjectProphecy $next; private ObjectProphecy $next;

View File

@@ -9,6 +9,7 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException; use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
use Shlinkio\Shlink\Rest\Entity\ApiKey; use Shlinkio\Shlink\Rest\Entity\ApiKey;
@@ -16,6 +17,8 @@ use Shlinkio\Shlink\Rest\Service\ApiKeyService;
class ApiKeyServiceTest extends TestCase class ApiKeyServiceTest extends TestCase
{ {
use ProphecyTrait;
private ApiKeyService $service; private ApiKeyService $service;
private ObjectProphecy $em; private ObjectProphecy $em;