From 093914e7ec2c42d013e50c88ec2247a033fddf7a Mon Sep 17 00:00:00 2001 From: peter279k Date: Sun, 12 Jan 2020 02:15:49 +0800 Subject: [PATCH] Add PHP 7.4 version test --- .travis.yml | 17 +++++------ composer.json | 4 +-- phpunit.xml.dist | 1 - .../Pull/MemoryUniquePullCommandQueue.php | 2 +- .../ExecutingSubscribeCommandQueue.php | 2 +- .../Subscribe/PredisSubscribeCommandQueue.php | 2 +- .../Bus/HandlerLocatedCommandBusTest.php | 19 +++++++------ .../ContainerCommandHandlerLocatorTest.php | 13 +++++---- ...DirectBindingCommandHandlerLocatorTest.php | 8 ++++-- ...fonyContainerCommandHandlerLocatorTest.php | 13 +++++---- .../Queue/Pull/MemoryPullCommandQueueTest.php | 2 +- .../Pull/MemoryUniquePullCommandQueueTest.php | 2 +- .../Queue/Pull/PredisPullCommandQueueTest.php | 20 ++++++++----- .../Pull/PredisUniquePullCommandQueueTest.php | 20 ++++++++----- .../Serializer/SymfonySerializerTest.php | 7 +++-- .../ExecutingSubscribeCommandQueueTest.php | 8 ++++-- .../PredisSubscribeCommandQueueTest.php | 28 +++++++++++-------- .../Query/Bus/HandlerLocatedQueryBusTest.php | 20 +++++++------ .../ContainerQueryHandlerLocatorTest.php | 13 +++++---- .../DirectBindingQueryHandlerLocatorTest.php | 8 ++++-- ...ymfonyContainerQueryHandlerLocatorTest.php | 13 +++++---- 21 files changed, 131 insertions(+), 91 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0fe0a5..2181eb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,29 +12,26 @@ branches: matrix: fast_finish: true include: + - php: 7.4 - php: 7.3 - - php: 7.2 - php: 7.1 - - php: 7.0 - - php: 5.6 - - php: 5.5 dist: trusty - - php: 5.5 + - php: 7.1 dist: trusty env: SYMFONY_VERSION=2.7.* - - php: 5.5 + - php: 7.1 dist: trusty env: SYMFONY_VERSION=2.8.* - - php: 5.5 + - php: 7.1 dist: trusty env: SYMFONY_VERSION=3.0.* - - php: 5.5 + - php: 7.1 dist: trusty env: PREDIS_VERSION=1.0.* - - php: 5.5 + - php: 7.1 dist: trusty env: PREDIS_VERSION=1.1.* - - php: 5.6 + - php: 7.2 env: PUBSUB_PREDIS_VERSION=2.0.* before_install: diff --git a/composer.json b/composer.json index b93fb89..caa706b 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } }, "require": { - "php": ">=5.5.0" + "php": ">=7.1.0" }, "require-dev": { "psr/container": "~1.0", @@ -31,7 +31,7 @@ "symfony/dependency-injection": "~2.3|~3.0", "symfony/serializer": "~2.3|~3.0", "predis/predis": "~1.0|~1.1", - "phpunit/phpunit": "^4.8.36", + "phpunit/phpunit": "^7.0|^8.2", "scrutinizer/ocular": "~1.3", "php-coveralls/php-coveralls": "^1.0" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 88eaad6..63a8b8b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="tests/bootstrap.php" > diff --git a/src/Command/Queue/Pull/MemoryUniquePullCommandQueue.php b/src/Command/Queue/Pull/MemoryUniquePullCommandQueue.php index 78d36e8..5a69578 100644 --- a/src/Command/Queue/Pull/MemoryUniquePullCommandQueue.php +++ b/src/Command/Queue/Pull/MemoryUniquePullCommandQueue.php @@ -31,7 +31,7 @@ public function publish(Command $command) $index = array_search($command, $this->commands); // remove exists command and publish it again - if ($index !== false) { + if (false !== $index) { unset($this->commands[$index]); } diff --git a/src/Command/Queue/Subscribe/ExecutingSubscribeCommandQueue.php b/src/Command/Queue/Subscribe/ExecutingSubscribeCommandQueue.php index df4a815..0503949 100644 --- a/src/Command/Queue/Subscribe/ExecutingSubscribeCommandQueue.php +++ b/src/Command/Queue/Subscribe/ExecutingSubscribeCommandQueue.php @@ -57,7 +57,7 @@ public function unsubscribe(callable $handler) { $index = array_search($handler, $this->handlers); - if ($index === false) { + if (false === $index) { return false; } diff --git a/src/Command/Queue/Subscribe/PredisSubscribeCommandQueue.php b/src/Command/Queue/Subscribe/PredisSubscribeCommandQueue.php index 1f58cfb..c9c9288 100644 --- a/src/Command/Queue/Subscribe/PredisSubscribeCommandQueue.php +++ b/src/Command/Queue/Subscribe/PredisSubscribeCommandQueue.php @@ -109,7 +109,7 @@ public function unsubscribe(callable $handler) { $index = array_search($handler, $this->handlers); - if ($index === false) { + if (false === $index) { return false; } diff --git a/tests/Command/Bus/HandlerLocatedCommandBusTest.php b/tests/Command/Bus/HandlerLocatedCommandBusTest.php index 6b2ab14..a7c7981 100644 --- a/tests/Command/Bus/HandlerLocatedCommandBusTest.php +++ b/tests/Command/Bus/HandlerLocatedCommandBusTest.php @@ -13,17 +13,18 @@ use GpsLab\Component\Command\Bus\HandlerLocatedCommandBus; use GpsLab\Component\Command\Command; use GpsLab\Component\Command\Handler\Locator\CommandHandlerLocator; +use GpsLab\Component\Command\Exception\HandlerNotFoundException; use PHPUnit\Framework\TestCase; class HandlerLocatedCommandBusTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|CommandHandlerLocator + * @var \PHPUnit\Framework\MockObject\MockObject|CommandHandlerLocator */ private $locator; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Command + * @var \PHPUnit\Framework\MockObject\MockObject|Command */ private $command; @@ -32,10 +33,13 @@ class HandlerLocatedCommandBusTest extends TestCase */ private $bus; - protected function setUp() + protected function setUp(): void { - $this->command = $this->getMock(Command::class); - $this->locator = $this->getMock(CommandHandlerLocator::class); + $this->command = $this->getMockBuilder(Command::class); + $this->command = $this->command->getMock(); + + $this->locator = $this->getMockBuilder(CommandHandlerLocator::class); + $this->locator = $this->locator->getMock(); $this->bus = new HandlerLocatedCommandBus($this->locator); } @@ -57,11 +61,10 @@ public function testHandle() $this->assertEquals($this->command, $handled_command); } - /** - * @expectedException \GpsLab\Component\Command\Exception\HandlerNotFoundException - */ public function testNoHandler() { + $this->expectException(HandlerNotFoundException::class); + $this->locator ->expects($this->once()) ->method('findHandler') diff --git a/tests/Command/Handler/Locator/ContainerCommandHandlerLocatorTest.php b/tests/Command/Handler/Locator/ContainerCommandHandlerLocatorTest.php index d8337cb..b30cd06 100644 --- a/tests/Command/Handler/Locator/ContainerCommandHandlerLocatorTest.php +++ b/tests/Command/Handler/Locator/ContainerCommandHandlerLocatorTest.php @@ -20,12 +20,12 @@ class ContainerCommandHandlerLocatorTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface */ private $container; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Command + * @var \PHPUnit\Framework\MockObject\MockObject|Command */ private $command; @@ -39,13 +39,16 @@ class ContainerCommandHandlerLocatorTest extends TestCase */ private $locator; - protected function setUp() + protected function setUp(): void { - $this->command = $this->getMock(Command::class); + $this->command = $this->getMockBuilder(Command::class); + $this->command = $this->command->getMock(); + $this->handler = function (Command $command) { $this->assertEquals($command, $this->command); }; - $this->container = $this->getMock(ContainerInterface::class); + $this->container = $this->getMockBuilder(ContainerInterface::class); + $this->container = $this->container->getMock(); $this->locator = new ContainerCommandHandlerLocator($this->container); } diff --git a/tests/Command/Handler/Locator/DirectBindingCommandHandlerLocatorTest.php b/tests/Command/Handler/Locator/DirectBindingCommandHandlerLocatorTest.php index 62e20ac..1d2ba5d 100644 --- a/tests/Command/Handler/Locator/DirectBindingCommandHandlerLocatorTest.php +++ b/tests/Command/Handler/Locator/DirectBindingCommandHandlerLocatorTest.php @@ -17,7 +17,7 @@ class DirectBindingCommandHandlerLocatorTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Command + * @var \PHPUnit\Framework\MockObject\MockObject|Command */ private $command; @@ -31,9 +31,11 @@ class DirectBindingCommandHandlerLocatorTest extends TestCase */ private $locator; - protected function setUp() + protected function setUp(): void { - $this->command = $this->getMock(Command::class); + $this->command = $this->getMockBuilder(Command::class); + $this->command = $this->command->getMock(); + $this->handler = function (Command $command) { $this->assertEquals($command, $this->command); }; diff --git a/tests/Command/Handler/Locator/SymfonyContainerCommandHandlerLocatorTest.php b/tests/Command/Handler/Locator/SymfonyContainerCommandHandlerLocatorTest.php index 970c120..2682b68 100644 --- a/tests/Command/Handler/Locator/SymfonyContainerCommandHandlerLocatorTest.php +++ b/tests/Command/Handler/Locator/SymfonyContainerCommandHandlerLocatorTest.php @@ -20,12 +20,12 @@ class SymfonyContainerCommandHandlerLocatorTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface */ private $container; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Command + * @var \PHPUnit\Framework\MockObject\MockObject|Command */ private $command; @@ -39,13 +39,16 @@ class SymfonyContainerCommandHandlerLocatorTest extends TestCase */ private $locator; - protected function setUp() + protected function setUp(): void { - $this->command = $this->getMock(Command::class); + $this->command = $this->getMockBuilder(Command::class); + $this->command = $this->command->getMock(); + $this->handler = function (Command $command) { $this->assertEquals($command, $this->command); }; - $this->container = $this->getMock(ContainerInterface::class); + $this->container = $this->getMockBuilder(ContainerInterface::class); + $this->container = $this->container->getMock(); $this->locator = new SymfonyContainerCommandHandlerLocator(); } diff --git a/tests/Command/Queue/Pull/MemoryPullCommandQueueTest.php b/tests/Command/Queue/Pull/MemoryPullCommandQueueTest.php index 5a3561a..c7f9b3f 100644 --- a/tests/Command/Queue/Pull/MemoryPullCommandQueueTest.php +++ b/tests/Command/Queue/Pull/MemoryPullCommandQueueTest.php @@ -22,7 +22,7 @@ class MemoryPullCommandQueueTest extends TestCase */ private $queue; - protected function setUp() + protected function setUp(): void { $this->queue = new MemoryPullCommandQueue(); } diff --git a/tests/Command/Queue/Pull/MemoryUniquePullCommandQueueTest.php b/tests/Command/Queue/Pull/MemoryUniquePullCommandQueueTest.php index 9251c29..67e1514 100644 --- a/tests/Command/Queue/Pull/MemoryUniquePullCommandQueueTest.php +++ b/tests/Command/Queue/Pull/MemoryUniquePullCommandQueueTest.php @@ -22,7 +22,7 @@ class MemoryUniquePullCommandQueueTest extends TestCase */ private $queue; - protected function setUp() + protected function setUp(): void { $this->queue = new MemoryUniquePullCommandQueue(); } diff --git a/tests/Command/Queue/Pull/PredisPullCommandQueueTest.php b/tests/Command/Queue/Pull/PredisPullCommandQueueTest.php index 7c0c32b..7851a19 100644 --- a/tests/Command/Queue/Pull/PredisPullCommandQueueTest.php +++ b/tests/Command/Queue/Pull/PredisPullCommandQueueTest.php @@ -21,17 +21,17 @@ class PredisPullCommandQueueTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Client + * @var \PHPUnit\Framework_MockObject\MockObject|Client */ private $client; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Serializer + * @var \PHPUnit\Framework\MockObject\MockObject|Serializer */ private $serializer; /** - * @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface */ private $logger; @@ -45,11 +45,17 @@ class PredisPullCommandQueueTest extends TestCase */ private $queue_name = 'commands'; - protected function setUp() + protected function setUp(): void { - $this->client = $this->getMock(Client::class); - $this->serializer = $this->getMock(Serializer::class); - $this->logger = $this->getMock(LoggerInterface::class); + $this->client = $this->getMockBuilder(Client::class); + $this->client = $this->client->getMock(); + + $this->serializer = $this->getMockBuilder(Serializer::class); + $this->serializer = $this->serializer->getMock(); + + $this->logger = $this->getMockBuilder(LoggerInterface::class); + $this->logger = $this->logger->getMock(); + $this->queue = new PredisPullCommandQueue($this->client, $this->serializer, $this->logger, $this->queue_name); } diff --git a/tests/Command/Queue/Pull/PredisUniquePullCommandQueueTest.php b/tests/Command/Queue/Pull/PredisUniquePullCommandQueueTest.php index 68b4c1c..2b167e5 100644 --- a/tests/Command/Queue/Pull/PredisUniquePullCommandQueueTest.php +++ b/tests/Command/Queue/Pull/PredisUniquePullCommandQueueTest.php @@ -21,17 +21,17 @@ class PredisUniquePullCommandQueueTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Client + * @var \PHPUnit\Framework\MockObject\MockObject|Client */ private $client; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Serializer + * @var \PHPUnit\Framework\MockObject\MockObject|Serializer */ private $serializer; /** - * @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface */ private $logger; @@ -45,11 +45,17 @@ class PredisUniquePullCommandQueueTest extends TestCase */ private $queue_name = 'unique_commands'; - protected function setUp() + protected function setUp(): void { - $this->client = $this->getMock(Client::class); - $this->serializer = $this->getMock(Serializer::class); - $this->logger = $this->getMock(LoggerInterface::class); + $this->client = $this->getMockBuilder(Client::class); + $this->client = $this->client->getMock(); + + $this->serializer = $this->getMockBuilder(Serializer::class); + $this->serializer = $this->serializer->getMock(); + + $this->logger = $this->getMockBuilder(LoggerInterface::class); + $this->logger = $this->logger->getMock(); + $this->queue = new PredisUniquePullCommandQueue( $this->client, $this->serializer, diff --git a/tests/Command/Queue/Serializer/SymfonySerializerTest.php b/tests/Command/Queue/Serializer/SymfonySerializerTest.php index cc4d3ac..92c21d3 100644 --- a/tests/Command/Queue/Serializer/SymfonySerializerTest.php +++ b/tests/Command/Queue/Serializer/SymfonySerializerTest.php @@ -18,13 +18,14 @@ class SymfonySerializerTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|SerializerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|SerializerInterface */ private $serializer; - protected function setUp() + protected function setUp(): void { - $this->serializer = $this->getMock(SerializerInterface::class); + $this->serializer = $this->getMockBuilder(SerializerInterface::class); + $this->serializer = $this->serializer->getMock(); } /** diff --git a/tests/Command/Queue/Subscribe/ExecutingSubscribeCommandQueueTest.php b/tests/Command/Queue/Subscribe/ExecutingSubscribeCommandQueueTest.php index 1150501..4df7216 100644 --- a/tests/Command/Queue/Subscribe/ExecutingSubscribeCommandQueueTest.php +++ b/tests/Command/Queue/Subscribe/ExecutingSubscribeCommandQueueTest.php @@ -17,7 +17,7 @@ class ExecutingSubscribeCommandQueueTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Command + * @var \PHPUnit\Framework\MockObject\MockObject|Command */ private $command; @@ -26,9 +26,11 @@ class ExecutingSubscribeCommandQueueTest extends TestCase */ private $queue; - protected function setUp() + protected function setUp(): void { - $this->command = $this->getMock(Command::class); + $this->command = $this->getMockBuilder(Command::class); + $this->command = $this->command->getMock(); + $this->queue = new ExecutingSubscribeCommandQueue(); } diff --git a/tests/Command/Queue/Subscribe/PredisSubscribeCommandQueueTest.php b/tests/Command/Queue/Subscribe/PredisSubscribeCommandQueueTest.php index 4c1292e..13098b7 100644 --- a/tests/Command/Queue/Subscribe/PredisSubscribeCommandQueueTest.php +++ b/tests/Command/Queue/Subscribe/PredisSubscribeCommandQueueTest.php @@ -10,6 +10,7 @@ namespace GpsLab\Component\Tests\Command\Queue\Subscribe; +use Exception; use GpsLab\Component\Command\Command; use GpsLab\Component\Command\Queue\Serializer\Serializer; use GpsLab\Component\Command\Queue\Subscribe\PredisSubscribeCommandQueue; @@ -20,22 +21,22 @@ class PredisSubscribeCommandQueueTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Command + * @var \PHPUnit\Framework\MockObject\MockObject|Command */ private $command; /** - * @var \PHPUnit_Framework_MockObject_MockObject|RedisPubSubAdapter + * @var \PHPUnit\Framework\MockObject\MockObject|RedisPubSubAdapter */ private $client; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Serializer + * @var \PHPUnit\Framework\MockObject\MockObject|Serializer */ private $serializer; /** - * @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface */ private $logger; @@ -49,15 +50,21 @@ class PredisSubscribeCommandQueueTest extends TestCase */ private $queue_name = 'commands'; - protected function setUp() + protected function setUp(): void { if (!class_exists(RedisPubSubAdapter::class)) { $this->markTestSkipped('php-pubsub-redis is not installed.'); } - $this->command = $this->getMock(Command::class); - $this->serializer = $this->getMock(Serializer::class); - $this->logger = $this->getMock(LoggerInterface::class); + $this->command = $this->getMockBuilder(Command::class); + $this->command = $this->command->getMock(); + + $this->serializer = $this->getMockBuilder(Serializer::class); + $this->serializer = $this->serializer->getMock(); + + $this->logger = $this->getMockBuilder(LoggerInterface::class); + $this->logger = $this->logger->getMock(); + $this->client = $this ->getMockBuilder(RedisPubSubAdapter::class) ->disableOriginalConstructor() @@ -173,11 +180,10 @@ public function testSubscribeFailure() $this->assertFalse($subscriber_called); } - /** - * @expectedException \Exception - */ public function testSubscribeHandlerFailure() { + $this->expectException(Exception::class); + $exception = new \Exception('bar'); $handler = function ($command) use ($exception) { $this->assertInstanceOf(Command::class, $command); diff --git a/tests/Query/Bus/HandlerLocatedQueryBusTest.php b/tests/Query/Bus/HandlerLocatedQueryBusTest.php index 27b63a7..d9f8906 100644 --- a/tests/Query/Bus/HandlerLocatedQueryBusTest.php +++ b/tests/Query/Bus/HandlerLocatedQueryBusTest.php @@ -13,17 +13,18 @@ use GpsLab\Component\Query\Bus\HandlerLocatedQueryBus; use GpsLab\Component\Query\Query; use GpsLab\Component\Query\Handler\Locator\QueryHandlerLocator; +use GpsLab\Component\Query\Exception\HandlerNotFoundException; use PHPUnit\Framework\TestCase; class HandlerLocatedQueryBusTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|QueryHandlerLocator + * @var \PHPUnit\Framework\MockObject\MockObject|QueryHandlerLocator */ private $locator; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Query + * @var \PHPUnit\Framework\MockObject\MockObject|Query */ private $query; @@ -37,13 +38,17 @@ class HandlerLocatedQueryBusTest extends TestCase */ private $bus; - protected function setUp() + protected function setUp(): void { - $this->query = $this->getMock(Query::class); + $this->query = $this->getMockBuilder(Query::class); + $this->query = $this->query->getMock(); + $this->handler = function (Query $query) { $this->assertEquals($this->query, $query); }; - $this->locator = $this->getMock(QueryHandlerLocator::class); + $this->locator = $this->getMockBuilder(QueryHandlerLocator::class); + $this->locator = $this->locator->getMock(); + $this->bus = new HandlerLocatedQueryBus($this->locator); } @@ -67,11 +72,10 @@ public function testDispatch() $this->assertEquals($this->query, $handled_query); } - /** - * @expectedException \GpsLab\Component\Query\Exception\HandlerNotFoundException - */ public function testNoHandler() { + $this->expectException(HandlerNotFoundException::class); + $this->locator ->expects($this->once()) ->method('findHandler') diff --git a/tests/Query/Handler/Locator/ContainerQueryHandlerLocatorTest.php b/tests/Query/Handler/Locator/ContainerQueryHandlerLocatorTest.php index 931a803..8491d18 100644 --- a/tests/Query/Handler/Locator/ContainerQueryHandlerLocatorTest.php +++ b/tests/Query/Handler/Locator/ContainerQueryHandlerLocatorTest.php @@ -20,12 +20,12 @@ class ContainerQueryHandlerLocatorTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface */ private $container; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Query + * @var \PHPUnit\Framework\MockObject\MockObject|Query */ private $query; @@ -39,13 +39,16 @@ class ContainerQueryHandlerLocatorTest extends TestCase */ private $locator; - protected function setUp() + protected function setUp(): void { - $this->query = $this->getMock(Query::class); + $this->query = $this->getMockBuilder(Query::class); + $this->query = $this->query->getMock(); + $this->handler = function (Query $query) { $this->assertEquals($query, $this->query); }; - $this->container = $this->getMock(ContainerInterface::class); + $this->container = $this->getMockBuilder(ContainerInterface::class); + $this->container = $this->container->getMock(); $this->locator = new ContainerQueryHandlerLocator($this->container); } diff --git a/tests/Query/Handler/Locator/DirectBindingQueryHandlerLocatorTest.php b/tests/Query/Handler/Locator/DirectBindingQueryHandlerLocatorTest.php index ed4a65e..b452fe8 100644 --- a/tests/Query/Handler/Locator/DirectBindingQueryHandlerLocatorTest.php +++ b/tests/Query/Handler/Locator/DirectBindingQueryHandlerLocatorTest.php @@ -17,7 +17,7 @@ class DirectBindingQueryHandlerLocatorTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|Query + * @var \PHPUnit\Framework\MockObject\MockObject|Query */ private $query; @@ -31,9 +31,11 @@ class DirectBindingQueryHandlerLocatorTest extends TestCase */ private $locator; - protected function setUp() + protected function setUp(): void { - $this->query = $this->getMock(Query::class); + $this->query = $this->getMockBuilder(Query::class); + $this->query = $this->query->getMock(); + $this->handler = function (Query $query) { $this->assertEquals($query, $this->query); }; diff --git a/tests/Query/Handler/Locator/SymfonyContainerQueryHandlerLocatorTest.php b/tests/Query/Handler/Locator/SymfonyContainerQueryHandlerLocatorTest.php index c1cd309..677cee7 100644 --- a/tests/Query/Handler/Locator/SymfonyContainerQueryHandlerLocatorTest.php +++ b/tests/Query/Handler/Locator/SymfonyContainerQueryHandlerLocatorTest.php @@ -20,12 +20,12 @@ class SymfonyContainerQueryHandlerLocatorTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface */ private $container; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Query + * @var \PHPUnit\Framework\MockObject\MockObject|Query */ private $query; @@ -39,13 +39,16 @@ class SymfonyContainerQueryHandlerLocatorTest extends TestCase */ private $locator; - protected function setUp() + protected function setUp(): void { - $this->query = $this->getMock(Query::class); + $this->query = $this->getMockBuilder(Query::class); + $this->query = $this->query->getMock(); + $this->handler = function (Query $query) { $this->assertEquals($query, $this->query); }; - $this->container = $this->getMock(ContainerInterface::class); + $this->container = $this->getMockBuilder(ContainerInterface::class); + $this->container = $this->container->getMock(); $this->locator = new SymfonyContainerQueryHandlerLocator(); }