diff --git a/.travis.yml b/.travis.yml index ecc11eaf0..76968a051 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,39 +7,42 @@ matrix: include: - php: 7.1 sudo: false - env: SYMFONY_VERSION=3.4.* PHPSTAN=true + env: SYMFONY_VERSION=4.3.* PHPSTAN=true - php: 7.1 sudo: false - env: SYMFONY_VERSION=3.4.* PHP_CS_FIXER=true + env: SYMFONY_VERSION=4.3.* PHP_CS_FIXER=true - php: 7.1 sudo: false - env: SYMFONY_VERSION=3.4.* UNIT_TESTS=true - - php: 7.1 + env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true + - php: 7.2 sudo: false - env: SYMFONY_VERSION=4.0.* UNIT_TESTS=true + env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true - php: 7.2 sudo: false - env: SYMFONY_VERSION=4.0.* UNIT_TESTS=true + env: SYMFONY_VERSION=5.0.* UNIT_TESTS=true - php: 7.3 sudo: false - env: SYMFONY_VERSION=4.1.* UNIT_TESTS=true + env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true - php: 7.3 sudo: false - env: SYMFONY_VERSION=4.2.* UNIT_TESTS=true + env: SYMFONY_VERSION=4.4.* UNIT_TESTS=true + - php: 7.3 + sudo: false + env: SYMFONY_VERSION=5.0.* UNIT_TESTS=true - php: 7.1 - services: docker sudo: required - env: SYMFONY_VERSION=3.4.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true - - php: 7.1 + services: docker + env: SYMFONY_VERSION=4.3.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true + - php: 7.3 sudo: required services: docker - env: SYMFONY_VERSION=4.0.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true + env: SYMFONY_VERSION=5.0.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true - php: 7.1 sudo: required services: docker - env: SYMFONY_VERSION=3.4.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true + env: SYMFONY_VERSION=4.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true allow_failures: - - env: SYMFONY_VERSION=3.4.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true + - env: SYMFONY_VERSION=4.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true cache: directories: @@ -66,12 +69,12 @@ script: - if [ "$UNIT_TESTS" = true ]; then bin/phpunit --exclude-group=functional; fi - if [ "$FUNCTIONAL_TESTS" = true ]; then bin/test.sh --exclude-group=rdkafka; fi - if [ "RDKAFKA_TESTS" = true ]; then bin/test.sh --group=rdkafka; fi - + notifications: webhooks: urls: - https://webhooks.gitter.im/e/3f8b3668e7792de23a49 - on_success: change - on_failure: always - on_start: never + on_success: change + on_failure: always + on_start: never diff --git a/composer.json b/composer.json index 6a115bf02..866f41d02 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "ext-amqp": "^1.9.3", "ext-gearman": "^2.0", - "ext-mongodb": "^1.3", + "ext-mongodb": "^1.5", "ext-rdkafka": "^3.0.3", "queue-interop/amqp-interop": "^0.8", @@ -35,14 +35,14 @@ "php-http/client-common": "^1.7@dev", "richardfullmer/rabbitmq-management-api": "^2.0", "predis/predis": "^1.1", + "thruway/client": "^0.5.0", "thruway/pawl-transport": "^0.5.0", - "voryx/thruway": "^0.5.3", "influxdb/influxdb-php": "^1.14", "datadog/php-datadogstatsd": "^1.3" }, "require-dev": { - "phpunit/phpunit": "^5.5", - "phpstan/phpstan": "^0.10", + "phpunit/phpunit": "^7.5", + "phpstan/phpstan": "^0.12", "queue-interop/queue-spec": "^0.6", "symfony/browser-kit": "^3.4|^4", "symfony/config": "^3.4|^4", @@ -54,9 +54,10 @@ "symfony/http-kernel": "^3.4|^4", "symfony/filesystem": "^3.4|^4", "symfony/framework-bundle": "^3.4|^4", + "symfony/yaml": "^4.3|^5", "empi89/php-amqp-stubs": "*@dev", - "doctrine/doctrine-bundle": "~1.2", - "doctrine/mongodb-odm-bundle": "^3.5", + "doctrine/doctrine-bundle": "~1.2|^2", + "doctrine/mongodb-odm-bundle": "^3.5|^4", "alcaeus/mongo-php-adapter": "^1.0", "kwn/php-rdkafka-stubs": "^1.0.2", "friendsofphp/php-cs-fixer": "^2" @@ -112,7 +113,7 @@ "ext-amqp": "1.9.3", "ext-gearman": "2.0.3", "ext-rdkafka": "3.3", - "ext-mongodb": "1.3", + "ext-mongodb": "1.5", "ext-bcmath": "1", "ext-mbstring": "1", "ext-mongo": "1.6.14" diff --git a/docker-compose.yml b/docker-compose.yml index 87260d4e0..ddae063b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,15 +117,9 @@ services: - "27017:27017" thruway: - image: formapro/nginx-php-fpm:latest-all-exts + build: './docker/thruway' ports: - '9090:9090' - working_dir: '/app' - volumes: - - './:/app' - entrypoint: - - '/usr/bin/php' - - 'docker/thruway/WsRouter.php' localstack: image: 'localstack/localstack:latest' diff --git a/docker/thruway/Dockerfile b/docker/thruway/Dockerfile new file mode 100644 index 000000000..c9e795478 --- /dev/null +++ b/docker/thruway/Dockerfile @@ -0,0 +1,13 @@ +FROM formapro/nginx-php-fpm:latest-all-exts + +RUN mkdir -p /thruway +WORKDIR /thruway + +# Thruway router +COPY --from=composer /usr/bin/composer /usr/bin/composer +RUN COMPOSER_HOME=/thruway composer global require --prefer-dist --no-scripts voryx/thruway + +COPY WsRouter.php . + +CMD ["/usr/bin/php", "WsRouter.php"] + diff --git a/docker/thruway/WsRouter.php b/docker/thruway/WsRouter.php index 36b7eb0dc..ee5bb948a 100644 --- a/docker/thruway/WsRouter.php +++ b/docker/thruway/WsRouter.php @@ -1,6 +1,6 @@ diff --git a/pkg/amqp-bunny/Tests/AmqpConsumerTest.php b/pkg/amqp-bunny/Tests/AmqpConsumerTest.php index 4f1f1a4c5..a588c2e56 100644 --- a/pkg/amqp-bunny/Tests/AmqpConsumerTest.php +++ b/pkg/amqp-bunny/Tests/AmqpConsumerTest.php @@ -14,6 +14,7 @@ use Interop\Amqp\Impl\AmqpQueue; use Interop\Queue\Consumer; use Interop\Queue\Exception\InvalidMessageException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpConsumerTest extends TestCase @@ -205,7 +206,7 @@ public function testShouldReturnMessageOnReceiveWithReceiveMethodBasicGet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Client + * @return MockObject|Client */ public function createClientMock() { @@ -213,7 +214,7 @@ public function createClientMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return MockObject|AmqpContext */ public function createContextMock() { @@ -221,7 +222,7 @@ public function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Channel + * @return MockObject|Channel */ public function createBunnyChannelMock() { diff --git a/pkg/amqp-bunny/Tests/AmqpContextTest.php b/pkg/amqp-bunny/Tests/AmqpContextTest.php index 74b3534bc..69d9b5012 100644 --- a/pkg/amqp-bunny/Tests/AmqpContextTest.php +++ b/pkg/amqp-bunny/Tests/AmqpContextTest.php @@ -9,6 +9,7 @@ use Interop\Amqp\Impl\AmqpBind; use Interop\Amqp\Impl\AmqpQueue; use Interop\Amqp\Impl\AmqpTopic; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpContextTest extends TestCase @@ -244,7 +245,7 @@ public function testShouldReturnExpectedSubscriptionConsumerInstance() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Channel + * @return MockObject|Channel */ public function createChannelMock() { diff --git a/pkg/amqp-bunny/Tests/AmqpProducerTest.php b/pkg/amqp-bunny/Tests/AmqpProducerTest.php index df33598b2..e9244297c 100644 --- a/pkg/amqp-bunny/Tests/AmqpProducerTest.php +++ b/pkg/amqp-bunny/Tests/AmqpProducerTest.php @@ -17,6 +17,7 @@ use Interop\Queue\Exception\InvalidMessageException; use Interop\Queue\Message; use Interop\Queue\Producer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpProducerTest extends TestCase @@ -200,7 +201,7 @@ public function testShouldPropagateFlags() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Message + * @return MockObject|Message */ private function createMessageMock() { @@ -208,7 +209,7 @@ private function createMessageMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Destination + * @return MockObject|Destination */ private function createDestinationMock() { @@ -216,7 +217,7 @@ private function createDestinationMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Channel + * @return MockObject|Channel */ private function createBunnyChannelMock() { @@ -224,7 +225,7 @@ private function createBunnyChannelMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return MockObject|AmqpContext */ private function createContextMock() { @@ -232,7 +233,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DelayStrategy + * @return MockObject|DelayStrategy */ private function createDelayStrategyMock() { diff --git a/pkg/amqp-bunny/Tests/AmqpSubscriptionConsumerTest.php b/pkg/amqp-bunny/Tests/AmqpSubscriptionConsumerTest.php index fbc3bcbce..c1d056268 100644 --- a/pkg/amqp-bunny/Tests/AmqpSubscriptionConsumerTest.php +++ b/pkg/amqp-bunny/Tests/AmqpSubscriptionConsumerTest.php @@ -5,6 +5,7 @@ use Enqueue\AmqpBunny\AmqpContext; use Enqueue\AmqpBunny\AmqpSubscriptionConsumer; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpSubscriptionConsumerTest extends TestCase @@ -22,7 +23,7 @@ public function testCouldBeConstructedWithAmqpContextAsFirstArgument() } /** - * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject + * @return AmqpContext|MockObject */ private function createAmqpContextMock() { diff --git a/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php b/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php index 63a3206be..a1f4ac57f 100644 --- a/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php +++ b/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php @@ -13,7 +13,7 @@ */ class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec { - protected function tearDown() + protected function tearDown(): void { if ($this->subscriptionConsumer) { $this->subscriptionConsumer->unsubscribeAll(); diff --git a/pkg/amqp-bunny/phpunit.xml.dist b/pkg/amqp-bunny/phpunit.xml.dist index 7d6c5ed3e..0db15a427 100644 --- a/pkg/amqp-bunny/phpunit.xml.dist +++ b/pkg/amqp-bunny/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/amqp-ext/Tests/AmqpConsumerTest.php b/pkg/amqp-ext/Tests/AmqpConsumerTest.php index bb515dda5..75c49cf01 100644 --- a/pkg/amqp-ext/Tests/AmqpConsumerTest.php +++ b/pkg/amqp-ext/Tests/AmqpConsumerTest.php @@ -7,6 +7,7 @@ use Enqueue\Test\ClassExtensionTrait; use Interop\Amqp\Impl\AmqpQueue; use Interop\Queue\Consumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpConsumerTest extends TestCase @@ -24,7 +25,7 @@ public function testCouldBeConstructedWithContextAndQueueAsArguments() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return MockObject|AmqpContext */ private function createContext() { diff --git a/pkg/amqp-ext/Tests/AmqpContextTest.php b/pkg/amqp-ext/Tests/AmqpContextTest.php index fa5c40969..bcf3b2200 100644 --- a/pkg/amqp-ext/Tests/AmqpContextTest.php +++ b/pkg/amqp-ext/Tests/AmqpContextTest.php @@ -14,6 +14,7 @@ use Interop\Amqp\Impl\AmqpTopic; use Interop\Queue\Context; use Interop\Queue\Exception\InvalidDestinationException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpContextTest extends TestCase @@ -243,7 +244,7 @@ public function testShouldReturnExpectedSubscriptionConsumerInstance() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\AMQPChannel + * @return MockObject|\AMQPChannel */ private function createExtChannelMock() { @@ -251,7 +252,7 @@ private function createExtChannelMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\AMQPChannel + * @return MockObject|\AMQPChannel */ private function createExtConnectionMock() { diff --git a/pkg/amqp-ext/Tests/AmqpSubscriptionConsumerTest.php b/pkg/amqp-ext/Tests/AmqpSubscriptionConsumerTest.php index 3650d6e1b..153fe275e 100644 --- a/pkg/amqp-ext/Tests/AmqpSubscriptionConsumerTest.php +++ b/pkg/amqp-ext/Tests/AmqpSubscriptionConsumerTest.php @@ -5,6 +5,7 @@ use Enqueue\AmqpExt\AmqpContext; use Enqueue\AmqpExt\AmqpSubscriptionConsumer; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpSubscriptionConsumerTest extends TestCase @@ -22,7 +23,7 @@ public function testCouldBeConstructedWithAmqpContextAsFirstArgument() } /** - * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject + * @return AmqpContext|MockObject */ private function createAmqpContextMock() { diff --git a/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php b/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php index 294248e4e..ee73345e9 100644 --- a/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php +++ b/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php @@ -30,7 +30,7 @@ public function setUp() $this->removeExchange('amqp_ext.test_exchange'); } - public function tearDown() + public function tearDown(): void { $this->amqpContext->close(); } diff --git a/pkg/amqp-ext/Tests/Functional/AmqpConsumptionUseCasesTest.php b/pkg/amqp-ext/Tests/Functional/AmqpConsumptionUseCasesTest.php index b480a1757..220554859 100644 --- a/pkg/amqp-ext/Tests/Functional/AmqpConsumptionUseCasesTest.php +++ b/pkg/amqp-ext/Tests/Functional/AmqpConsumptionUseCasesTest.php @@ -36,7 +36,7 @@ public function setUp() $this->removeQueue('amqp_ext.test'); } - public function tearDown() + public function tearDown(): void { $this->amqpContext->close(); } diff --git a/pkg/amqp-ext/Tests/Functional/AmqpRpcUseCasesTest.php b/pkg/amqp-ext/Tests/Functional/AmqpRpcUseCasesTest.php index bbc94423a..9e5dc4df3 100644 --- a/pkg/amqp-ext/Tests/Functional/AmqpRpcUseCasesTest.php +++ b/pkg/amqp-ext/Tests/Functional/AmqpRpcUseCasesTest.php @@ -31,7 +31,7 @@ public function setUp() $this->removeQueue('rpc.reply_test'); } - public function tearDown() + public function tearDown(): void { $this->amqpContext->close(); } diff --git a/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php b/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php index e77f657d6..ccb13bb89 100644 --- a/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php +++ b/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php @@ -13,7 +13,7 @@ */ class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec { - protected function tearDown() + protected function tearDown(): void { if ($this->subscriptionConsumer) { $this->subscriptionConsumer->unsubscribeAll(); diff --git a/pkg/amqp-ext/phpunit.xml.dist b/pkg/amqp-ext/phpunit.xml.dist index 4dca142e1..b24485336 100644 --- a/pkg/amqp-ext/phpunit.xml.dist +++ b/pkg/amqp-ext/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/amqp-lib/Tests/AmqpConsumerTest.php b/pkg/amqp-lib/Tests/AmqpConsumerTest.php index 854f38cd6..16b59227c 100644 --- a/pkg/amqp-lib/Tests/AmqpConsumerTest.php +++ b/pkg/amqp-lib/Tests/AmqpConsumerTest.php @@ -12,6 +12,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Exception\InvalidMessageException; use PhpAmqpLib\Channel\AMQPChannel; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpConsumerTest extends TestCase @@ -183,7 +184,7 @@ public function testShouldReturnMessageOnReceiveWithReceiveMethodBasicGet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return MockObject|AmqpContext */ public function createContextMock() { @@ -191,7 +192,7 @@ public function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AMQPChannel + * @return MockObject|AMQPChannel */ public function createLibChannelMock() { diff --git a/pkg/amqp-lib/Tests/AmqpContextTest.php b/pkg/amqp-lib/Tests/AmqpContextTest.php index 1fd8d8853..4cfde3c14 100644 --- a/pkg/amqp-lib/Tests/AmqpContextTest.php +++ b/pkg/amqp-lib/Tests/AmqpContextTest.php @@ -10,6 +10,7 @@ use PhpAmqpLib\Channel\AMQPChannel; use PhpAmqpLib\Connection\AbstractConnection; use PhpAmqpLib\Wire\AMQPTable; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpContextTest extends TestCase @@ -350,7 +351,7 @@ public function testShouldReturnExpectedSubscriptionConsumerInstance() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AbstractConnection + * @return MockObject|AbstractConnection */ public function createConnectionMock() { @@ -358,7 +359,7 @@ public function createConnectionMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AMQPChannel + * @return MockObject|AMQPChannel */ public function createChannelMock() { diff --git a/pkg/amqp-lib/Tests/AmqpProducerTest.php b/pkg/amqp-lib/Tests/AmqpProducerTest.php index 59fc82155..0bce53361 100644 --- a/pkg/amqp-lib/Tests/AmqpProducerTest.php +++ b/pkg/amqp-lib/Tests/AmqpProducerTest.php @@ -16,6 +16,7 @@ use PhpAmqpLib\Channel\AMQPChannel; use PhpAmqpLib\Message\AMQPMessage as LibAMQPMessage; use PhpAmqpLib\Wire\AMQPTable; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpProducerTest extends TestCase @@ -142,7 +143,7 @@ public function testShouldSetMessageProperties() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Message + * @return MockObject|Message */ private function createMessageMock() { @@ -150,7 +151,7 @@ private function createMessageMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Destination + * @return MockObject|Destination */ private function createDestinationMock() { @@ -158,7 +159,7 @@ private function createDestinationMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AMQPChannel + * @return MockObject|AMQPChannel */ private function createAmqpChannelMock() { @@ -166,7 +167,7 @@ private function createAmqpChannelMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return MockObject|AmqpContext */ private function createContextMock() { diff --git a/pkg/amqp-lib/Tests/AmqpSubscriptionConsumerTest.php b/pkg/amqp-lib/Tests/AmqpSubscriptionConsumerTest.php index 028d3067e..a87349771 100644 --- a/pkg/amqp-lib/Tests/AmqpSubscriptionConsumerTest.php +++ b/pkg/amqp-lib/Tests/AmqpSubscriptionConsumerTest.php @@ -5,6 +5,7 @@ use Enqueue\AmqpLib\AmqpContext; use Enqueue\AmqpLib\AmqpSubscriptionConsumer; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AmqpSubscriptionConsumerTest extends TestCase @@ -22,7 +23,7 @@ public function testCouldBeConstructedWithAmqpContextAndHeartbeatOnTickAsArgumen } /** - * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject + * @return AmqpContext|MockObject */ private function createAmqpContextMock() { diff --git a/pkg/amqp-lib/Tests/Functional/AmqpSubscriptionConsumerWithHeartbeatOnTickTest.php b/pkg/amqp-lib/Tests/Functional/AmqpSubscriptionConsumerWithHeartbeatOnTickTest.php index aea380d17..4d5b695e5 100644 --- a/pkg/amqp-lib/Tests/Functional/AmqpSubscriptionConsumerWithHeartbeatOnTickTest.php +++ b/pkg/amqp-lib/Tests/Functional/AmqpSubscriptionConsumerWithHeartbeatOnTickTest.php @@ -20,7 +20,7 @@ class AmqpSubscriptionConsumerWithHeartbeatOnTickTest extends TestCase */ private $context; - protected function tearDown() + protected function tearDown(): void { if ($this->context) { $this->context->close(); diff --git a/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php b/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php index 371e9a53c..a8bd48e01 100644 --- a/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php +++ b/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php @@ -13,7 +13,7 @@ */ class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec { - protected function tearDown() + protected function tearDown(): void { if ($this->subscriptionConsumer) { $this->subscriptionConsumer->unsubscribeAll(); diff --git a/pkg/amqp-lib/phpunit.xml.dist b/pkg/amqp-lib/phpunit.xml.dist index f6b8b173a..258e20c5e 100644 --- a/pkg/amqp-lib/phpunit.xml.dist +++ b/pkg/amqp-lib/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php b/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php index 17a8b2a5f..de2b77ec5 100644 --- a/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php +++ b/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php @@ -166,7 +166,7 @@ public function testShouldThrowExceptionIfInvalidDestination() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return \PHPUnit\Framework\MockObject\MockObject|AmqpContext */ private function createContextMock() { @@ -174,7 +174,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|TestProducer + * @return \PHPUnit\Framework\MockObject\MockObject|TestProducer */ private function createProducerMock() { @@ -194,25 +194,31 @@ public function send(Destination $destination, Message $message): void public function setDeliveryDelay(int $deliveryDelay = null): Producer { + throw new \BadMethodCallException('This should not be called directly'); } public function getDeliveryDelay(): ?int { + throw new \BadMethodCallException('This should not be called directly'); } public function setPriority(int $priority = null): Producer { + throw new \BadMethodCallException('This should not be called directly'); } public function getPriority(): ?int { + throw new \BadMethodCallException('This should not be called directly'); } public function setTimeToLive(int $timeToLive = null): Producer { + throw new \BadMethodCallException('This should not be called directly'); } public function getTimeToLive(): ?int { + throw new \BadMethodCallException('This should not be called directly'); } } diff --git a/pkg/amqp-tools/Tests/RabbitMqDlxDelayStrategyTest.php b/pkg/amqp-tools/Tests/RabbitMqDlxDelayStrategyTest.php index 8a45f8963..f519f8da3 100644 --- a/pkg/amqp-tools/Tests/RabbitMqDlxDelayStrategyTest.php +++ b/pkg/amqp-tools/Tests/RabbitMqDlxDelayStrategyTest.php @@ -12,6 +12,7 @@ use Interop\Amqp\Impl\AmqpQueue; use Interop\Amqp\Impl\AmqpTopic; use Interop\Queue\Exception\InvalidDestinationException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class RabbitMqDlxDelayStrategyTest extends TestCase @@ -181,7 +182,7 @@ public function testShouldThrowExceptionIfInvalidDestination() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext + * @return MockObject|AmqpContext */ private function createContextMock() { @@ -189,7 +190,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AmqpProducer + * @return MockObject|AmqpProducer */ private function createProducerMock() { diff --git a/pkg/amqp-tools/Tests/SignalSocketHelperTest.php b/pkg/amqp-tools/Tests/SignalSocketHelperTest.php index c8a10d80d..d869878c9 100644 --- a/pkg/amqp-tools/Tests/SignalSocketHelperTest.php +++ b/pkg/amqp-tools/Tests/SignalSocketHelperTest.php @@ -34,7 +34,7 @@ public function setUp() $this->signalHelper = new SignalSocketHelper(); } - public function tearDown() + public function tearDown(): void { parent::tearDown(); diff --git a/pkg/async-command/RunCommandProcessor.php b/pkg/async-command/RunCommandProcessor.php index f1495f399..2c4462f90 100644 --- a/pkg/async-command/RunCommandProcessor.php +++ b/pkg/async-command/RunCommandProcessor.php @@ -34,7 +34,11 @@ public function process(Message $message, Context $context): Result $phpBin = (new PhpExecutableFinder())->find(); $consoleBin = file_exists($this->projectDir.'/bin/console') ? './bin/console' : './app/console'; - $process = new Process($phpBin.' '.$consoleBin.' '.$this->getCommandLine($command), $this->projectDir); + $process = new Process(array_merge( + [$phpBin, $consoleBin, $command->getCommand()], + $command->getArguments(), + $this->getCommandLineOptions($command) + ), $this->projectDir); $process->setTimeout($this->timeout); $process->run(); @@ -48,22 +52,15 @@ public function process(Message $message, Context $context): Result } /** - * @return string + * @return string[] */ - private function getCommandLine(RunCommand $command): string + private function getCommandLineOptions(RunCommand $command): array { - $optionsString = ''; + $options = []; foreach ($command->getOptions() as $name => $value) { - $optionsString .= " $name=$value"; + $options[] = "$name=$value"; } - $optionsString = trim($optionsString); - $argumentsString = ''; - foreach ($command->getArguments() as $value) { - $argumentsString .= " $value"; - } - $argumentsString = trim($argumentsString); - - return trim($command->getCommand().' '.$argumentsString.' '.$optionsString); + return $options; } } diff --git a/pkg/async-command/composer.json b/pkg/async-command/composer.json index 7474c8834..0273ecb25 100644 --- a/pkg/async-command/composer.json +++ b/pkg/async-command/composer.json @@ -9,15 +9,16 @@ "php": ">=7.1", "enqueue/enqueue": "^0.9", "queue-interop/queue-interop": "^0.7|^0.8", - "symfony/console": "^3.4|^4", - "symfony/process": "^3.4|^4" + "symfony/console": "^4.3|^5", + "symfony/process": "^4.3|^5" }, "require-dev": { - "phpunit/phpunit": "~5.5", - "symfony/dependency-injection": "^3.4|^4", - "symfony/config": "^3.4|^4", - "symfony/http-kernel": "^3.4|^4", - "symfony/filesystem": "^3.4|^4", + "phpunit/phpunit": "~7.5", + "symfony/dependency-injection": "^4.3|^5", + "symfony/config": "^4.3|^5", + "symfony/http-kernel": "^4.3|^5", + "symfony/filesystem": "^4.3|^5", + "symfony/yaml": "^4.3|^5", "enqueue/null": "0.9.x-dev", "enqueue/fs": "0.9.x-dev", "enqueue/test": "0.9.x-dev" @@ -30,7 +31,7 @@ "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md" }, "suggest": { - "symfony/dependency-injection": "^3.4|^4 If you'd like to use async event dispatcher container extension." + "symfony/dependency-injection": "^4.3|^5 If you'd like to use async event dispatcher container extension." }, "autoload": { "psr-4": { "Enqueue\\AsyncCommand\\": "" }, diff --git a/pkg/async-event-dispatcher/AbstractAsyncEventDispatcher.php b/pkg/async-event-dispatcher/AbstractAsyncEventDispatcher.php new file mode 100644 index 000000000..5bc7d270a --- /dev/null +++ b/pkg/async-event-dispatcher/AbstractAsyncEventDispatcher.php @@ -0,0 +1,46 @@ +trueEventDispatcher = $trueEventDispatcher; + $this->asyncListener = $asyncListener; + } + + /** + * This method dispatches only those listeners that were marked as async. + * + * @param string $eventName + * @param ContractEvent|Event|null $event + */ + public function dispatchAsyncListenersOnly($eventName, $event = null) + { + try { + $this->asyncListener->syncMode($eventName); + + $this->parentDispatch($event, $eventName); + } finally { + $this->asyncListener->resetSyncMode(); + } + } + + abstract protected function parentDispatch($event, $eventName); +} diff --git a/pkg/async-event-dispatcher/AbstractAsyncListener.php b/pkg/async-event-dispatcher/AbstractAsyncListener.php new file mode 100644 index 000000000..d4ac19a1f --- /dev/null +++ b/pkg/async-event-dispatcher/AbstractAsyncListener.php @@ -0,0 +1,62 @@ +context = $context; + $this->registry = $registry; + $this->eventQueue = $eventQueue instanceof Queue ? $eventQueue : $context->createQueue($eventQueue); + } + + public function resetSyncMode() + { + $this->syncMode = []; + } + + /** + * @param string $eventName + */ + public function syncMode($eventName) + { + $this->syncMode[$eventName] = true; + } + + /** + * @param string $eventName + * + * @return bool + */ + public function isSyncMode($eventName) + { + return isset($this->syncMode[$eventName]); + } +} diff --git a/pkg/async-event-dispatcher/AbstractPhpSerializerEventTransformer.php b/pkg/async-event-dispatcher/AbstractPhpSerializerEventTransformer.php new file mode 100644 index 000000000..6ac53cbc2 --- /dev/null +++ b/pkg/async-event-dispatcher/AbstractPhpSerializerEventTransformer.php @@ -0,0 +1,24 @@ +context = $context; + } + + public function toEvent($eventName, Message $message) + { + return unserialize($message->getBody()); + } +} diff --git a/pkg/async-event-dispatcher/AsyncEventDispatcher.php b/pkg/async-event-dispatcher/AsyncEventDispatcher.php index c74d9745b..153fdc111 100644 --- a/pkg/async-event-dispatcher/AsyncEventDispatcher.php +++ b/pkg/async-event-dispatcher/AsyncEventDispatcher.php @@ -3,55 +3,47 @@ namespace Enqueue\AsyncEventDispatcher; use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class AsyncEventDispatcher extends EventDispatcher -{ +if (class_exists(Event::class)) { /** - * @var EventDispatcherInterface + * Symfony < 5.0. */ - private $trueEventDispatcher; - - /** - * @var AsyncListener - */ - private $asyncListener; - - /** - * @param EventDispatcherInterface $trueEventDispatcher - * @param AsyncListener $asyncListener - */ - public function __construct(EventDispatcherInterface $trueEventDispatcher, AsyncListener $asyncListener) + class AsyncEventDispatcher extends AbstractAsyncEventDispatcher { - $this->trueEventDispatcher = $trueEventDispatcher; - $this->asyncListener = $asyncListener; - } - - /** - * This method dispatches only those listeners that were marked as async. - * - * @param string $eventName - * @param Event|null $event - */ - public function dispatchAsyncListenersOnly($eventName, Event $event = null) - { - try { - $this->asyncListener->syncMode($eventName); + /** + * {@inheritdoc} + */ + public function dispatch($event, $eventName = null) + { + $this->parentDispatch($event, $eventName); + + return $this->trueEventDispatcher->dispatch($event, $eventName); + } - parent::dispatch($eventName, $event); - } finally { - $this->asyncListener->resetSyncMode(); + protected function parentDispatch($event, $eventName) + { + parent::dispatch($event, $eventName); } } - +} else { /** - * {@inheritdoc} + * Symfony >= 5.0. */ - public function dispatch($eventName, Event $event = null) + class AsyncEventDispatcher extends AbstractAsyncEventDispatcher { - parent::dispatch($eventName, $event); + /** + * {@inheritdoc} + */ + public function dispatch(object $event, string $eventName = null): object + { + $this->parentDispatch($event, $eventName); + + return $this->trueEventDispatcher->dispatch($event, $eventName); + } - $this->trueEventDispatcher->dispatch($eventName, $event); + protected function parentDispatch($event, $eventName) + { + return parent::dispatch($event, $eventName); + } } } diff --git a/pkg/async-event-dispatcher/AsyncListener.php b/pkg/async-event-dispatcher/AsyncListener.php index 54f4cf24c..ccbe5b038 100644 --- a/pkg/async-event-dispatcher/AsyncListener.php +++ b/pkg/async-event-dispatcher/AsyncListener.php @@ -2,86 +2,66 @@ namespace Enqueue\AsyncEventDispatcher; -use Interop\Queue\Context; -use Interop\Queue\Queue; use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event as ContractEvent; -class AsyncListener -{ +if (class_exists(Event::class)) { /** - * @var Context + * Symfony < 5.0. */ - private $context; - - /** - * @var Registry - */ - private $registry; - - /** - * @var Queue - */ - private $eventQueue; - - /** - * @var bool - */ - private $syncMode; - - /** - * @param Context $context - * @param Registry $registry - * @param Queue|string $eventQueue - */ - public function __construct(Context $context, Registry $registry, $eventQueue) + class AsyncListener extends AbstractAsyncListener { - $this->context = $context; - $this->registry = $registry; - $this->eventQueue = $eventQueue instanceof Queue ? $eventQueue : $context->createQueue($eventQueue); - } + /** + * @param Event|ContractEvent $event + * @param string $eventName + */ + public function __invoke($event, $eventName) + { + $this->onEvent($event, $eventName); + } - public function __invoke(Event $event, $eventName) - { - $this->onEvent($event, $eventName); - } + /** + * @param Event|ContractEvent $event + * @param string $eventName + */ + public function onEvent($event, $eventName) + { + if (false == isset($this->syncMode[$eventName])) { + $transformerName = $this->registry->getTransformerNameForEvent($eventName); - public function resetSyncMode() - { - $this->syncMode = []; - } + $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event); + $message->setProperty('event_name', $eventName); + $message->setProperty('transformer_name', $transformerName); - /** - * @param string $eventName - */ - public function syncMode($eventName) - { - $this->syncMode[$eventName] = true; + $this->context->createProducer()->send($this->eventQueue, $message); + } + } } - +} else { /** - * @param string $eventName - * - * @return bool + * Symfony >= 5.0. */ - public function isSyncMode($eventName) + class AsyncListener extends AbstractAsyncListener { - return isset($this->syncMode[$eventName]); - } + public function __invoke(ContractEvent $event, $eventName) + { + $this->onEvent($event, $eventName); + } - /** - * @param Event $event - * @param string $eventName - */ - public function onEvent(Event $event, $eventName) - { - if (false == isset($this->syncMode[$eventName])) { - $transformerName = $this->registry->getTransformerNameForEvent($eventName); + /** + * @param string $eventName + */ + public function onEvent(ContractEvent $event, $eventName) + { + if (false == isset($this->syncMode[$eventName])) { + $transformerName = $this->registry->getTransformerNameForEvent($eventName); - $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event); - $message->setProperty('event_name', $eventName); - $message->setProperty('transformer_name', $transformerName); + $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event); + $message->setProperty('event_name', $eventName); + $message->setProperty('transformer_name', $transformerName); - $this->context->createProducer()->send($this->eventQueue, $message); + $this->context->createProducer()->send($this->eventQueue, $message); + } } } } diff --git a/pkg/async-event-dispatcher/EventTransformer.php b/pkg/async-event-dispatcher/EventTransformer.php index abb67566f..352930cef 100644 --- a/pkg/async-event-dispatcher/EventTransformer.php +++ b/pkg/async-event-dispatcher/EventTransformer.php @@ -4,26 +4,60 @@ use Interop\Queue\Message; use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event as ContractEvent; -interface EventTransformer -{ +if (class_exists(Event::class)) { /** - * @param string $eventName - * @param Event|null $event - * - * @return Message + * Symfony < 5.0. */ - public function toMessage($eventName, Event $event = null); + interface EventTransformer + { + /** + * @param string $eventName + * @param ContractEvent|Event|null $event + * + * @return Message + */ + public function toMessage($eventName, $event = null); + /** + * If you able to transform message back to event return it. + * If you failed to transform for some reason you can return a string status. + * + * @param mixed $eventName + * + * @return ContractEvent|Event|string|object + * + * @see Process constants) or an object that implements __toString method. + * The object must have a __toString method is supposed to be used as Processor::process return value. + */ + public function toEvent($eventName, Message $message); + } +} else { /** - * If you able to transform message back to event return it. - * If you failed to transform for some reason you can return a string status (@see Process constants) or an object that implements __toString method. - * The object must have a __toString method is supposed to be used as Processor::process return value. - * - * @param string $eventName - * @param Message $message - * - * @return Event|string|object + * Symfony >= 5.0. */ - public function toEvent($eventName, Message $message); + interface EventTransformer + { + /** + * @param string $eventName + * + * @return Message + */ + public function toMessage($eventName, ContractEvent $event = null); + + /** + * If you able to transform message back to event return it. + * If you failed to transform for some reason you can return a string status. + * + * @param mixed $eventNAme + * @param mixed $eventName + * + * @return ContractEvent|string|object + * + * @see Process constants) or an object that implements __toString method. + * The object must have a __toString method is supposed to be used as Processor::process return value. + */ + public function toEvent($eventName, Message $message); + } } diff --git a/pkg/async-event-dispatcher/PhpSerializerEventTransformer.php b/pkg/async-event-dispatcher/PhpSerializerEventTransformer.php index 34392c439..c6a3e2c97 100644 --- a/pkg/async-event-dispatcher/PhpSerializerEventTransformer.php +++ b/pkg/async-event-dispatcher/PhpSerializerEventTransformer.php @@ -2,38 +2,29 @@ namespace Enqueue\AsyncEventDispatcher; -use Interop\Queue\Context; -use Interop\Queue\Message; use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event as ContractEvent; -class PhpSerializerEventTransformer implements EventTransformer -{ +if (class_exists(Event::class)) { /** - * @var Context + * Symfony < 5.0. */ - private $context; - - /** - * @param Context $context - */ - public function __construct(Context $context) + class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer { - $this->context = $context; + public function toMessage($eventName, $event = null) + { + return $this->context->createMessage(serialize($event)); + } } - - /** - * {@inheritdoc} - */ - public function toMessage($eventName, Event $event = null) - { - return $this->context->createMessage(serialize($event)); - } - +} else { /** - * {@inheritdoc} + * Symfony >= 5.0. */ - public function toEvent($eventName, Message $message) + class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer { - return unserialize($message->getBody()); + public function toMessage($eventName, ContractEvent $event = null) + { + return $this->context->createMessage(serialize($event)); + } } } diff --git a/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php b/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php index 6e019f6de..c5a1c3567 100644 --- a/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php +++ b/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php @@ -10,9 +10,12 @@ use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; use Interop\Queue\Producer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\GenericEvent; +use Symfony\Component\HttpKernel\Kernel; +use Symfony\Contracts\EventDispatcher\Event as ContractEvent; class AsyncListenerTest extends TestCase { @@ -68,7 +71,9 @@ public function testShouldDoNothingIfSyncModeOn() $listener->syncMode('fooEvent'); - $listener->onEvent(new Event(), 'fooEvent'); + $eventClass = Kernel::VERSION_ID >= 50000 ? ContractEvent::class : Event::class; + + $listener->onEvent(new $eventClass(), 'fooEvent'); $listener->onEvent(new GenericEvent(), 'fooEvent'); } @@ -129,7 +134,7 @@ public function testShouldSendMessageIfSyncModeOff() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|EventTransformer + * @return MockObject|EventTransformer */ private function createEventTransformerMock() { @@ -137,7 +142,7 @@ private function createEventTransformerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Producer + * @return MockObject|Producer */ private function createProducerMock() { @@ -145,7 +150,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return MockObject|Context */ private function createContextMock() { @@ -153,7 +158,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Registry + * @return MockObject|Registry */ private function createRegistryMock() { diff --git a/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php b/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php index 334022e92..7237c9ae2 100644 --- a/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php +++ b/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php @@ -11,6 +11,7 @@ use Enqueue\Null\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\GenericEvent; @@ -97,7 +98,7 @@ public function testShouldDispatchAsyncListenersOnly() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|EventTransformer + * @return MockObject|EventTransformer */ private function createEventTransformerMock() { @@ -105,7 +106,7 @@ private function createEventTransformerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AsyncEventDispatcher + * @return MockObject|AsyncEventDispatcher */ private function createProxyEventDispatcherMock() { @@ -113,7 +114,7 @@ private function createProxyEventDispatcherMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Registry + * @return MockObject|Registry */ private function createRegistryMock() { diff --git a/pkg/async-event-dispatcher/Tests/Functional/UseCasesTest.php b/pkg/async-event-dispatcher/Tests/Functional/UseCasesTest.php index e3848858b..d05a9add5 100644 --- a/pkg/async-event-dispatcher/Tests/Functional/UseCasesTest.php +++ b/pkg/async-event-dispatcher/Tests/Functional/UseCasesTest.php @@ -12,6 +12,7 @@ use Interop\Queue\Processor; use Interop\Queue\Queue; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -103,7 +104,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOne() echo "Async event\n"; }); - $this->dispatcher->dispatch('test_async', new GenericEvent()); + $this->dispatch($this->dispatcher, new GenericEvent(), 'test_async'); $this->processMessages(); $this->expectOutputString("Sync event\nSend message for event: test_async\nAsync event\n"); @@ -114,7 +115,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOneFromWhenDispatchedFrom $this->dispatcher->addListener('foo', function ($event, $name, EventDispatcherInterface $dispatcher) { echo "Foo event\n"; - $dispatcher->dispatch('test_async', new GenericEvent()); + $this->dispatch($dispatcher, new GenericEvent(), 'test_async'); }); $this->dispatcher->addListener('test_async', function () { @@ -127,7 +128,8 @@ public function testShouldDispatchBothAsyncEventAndSyncOneFromWhenDispatchedFrom echo "Async event\n"; }); - $this->dispatcher->dispatch('foo'); + $this->dispatch($this->dispatcher, new GenericEvent(), 'foo'); + $this->processMessages(); $this->expectOutputString("Foo event\nSync event\nSend message for event: test_async\nAsync event\n"); @@ -141,14 +143,14 @@ public function testShouldDispatchOtherAsyncEventFromAsyncEvent() $this->asyncDispatcher->addListener('test_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) { echo "Async event\n"; - $dispatcher->dispatch('test_async_from_async'); + $this->dispatch($dispatcher, new GenericEvent(), 'test_async_from_async'); }); $this->dispatcher->addListener('test_async_from_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) { echo "Async event from event\n"; }); - $this->dispatcher->dispatch('test_async'); + $this->dispatch($this->dispatcher, new GenericEvent(), 'test_async'); $this->processMessages(); $this->processMessages(); @@ -167,16 +169,27 @@ public function testShouldDispatchSyncListenerIfDispatchedFromAsycListner() $this->asyncDispatcher->addListener('test_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) { echo "Async event\n"; - $dispatcher->dispatch('sync'); + $this->dispatch($dispatcher, new GenericEvent(), 'sync'); }); - $this->dispatcher->dispatch('test_async'); + $this->dispatch($this->dispatcher, new GenericEvent(), 'test_async'); $this->processMessages(); $this->expectOutputString("Send message for event: test_async\nAsync event\nSync event\n"); } + private function dispatch(EventDispatcherInterface $dispatcher, $event, $eventName): void + { + if (!class_exists(Event::class)) { + // Symfony 5 + $dispatcher->dispatch($event, $eventName); + } else { + // Symfony < 5 + $dispatcher->dispatch($eventName, $event); + } + } + private function processMessages() { $consumer = $this->context->createConsumer($this->queue); diff --git a/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php b/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php index 8e9ee8179..49f3a9371 100644 --- a/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php +++ b/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php @@ -8,6 +8,7 @@ use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; use Interop\Queue\Message; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\GenericEvent; @@ -52,7 +53,7 @@ public function testShouldReturnEventUnserializedFromMessageBodyOnToEvent() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return MockObject|Context */ private function createContextStub() { diff --git a/pkg/async-event-dispatcher/Tests/ProxyEventDispatcherTest.php b/pkg/async-event-dispatcher/Tests/ProxyEventDispatcherTest.php index 7c8319147..eed680aa6 100644 --- a/pkg/async-event-dispatcher/Tests/ProxyEventDispatcherTest.php +++ b/pkg/async-event-dispatcher/Tests/ProxyEventDispatcherTest.php @@ -5,7 +5,9 @@ use Enqueue\AsyncEventDispatcher\AsyncEventDispatcher; use Enqueue\AsyncEventDispatcher\AsyncListener; use Enqueue\Test\ClassExtensionTrait; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\GenericEvent; @@ -80,7 +82,13 @@ public function testShouldCallOtherEventIfDispatchedFromAsyncEventOnDispatchAsyn $asyncEventWasCalled = true; - func_get_arg(2)->dispatch('theOtherEvent'); + if (!class_exists(Event::class)) { + // Symfony 5 + func_get_arg(2)->dispatch(func_get_arg(0), 'theOtherEvent'); + } else { + // Symfony < 5 + func_get_arg(2)->dispatch('theOtherEvent'); + } }); $event = new GenericEvent(); @@ -113,7 +121,7 @@ public function testShouldNotCallAsyncEventIfDispatchedFromOtherEventOnDispatchA } /** - * @return \PHPUnit_Framework_MockObject_MockObject|AsyncListener + * @return MockObject|AsyncListener */ private function createAsyncListenerMock() { diff --git a/pkg/async-event-dispatcher/composer.json b/pkg/async-event-dispatcher/composer.json index d5996f4aa..efd3f99bc 100644 --- a/pkg/async-event-dispatcher/composer.json +++ b/pkg/async-event-dispatcher/composer.json @@ -9,14 +9,15 @@ "php": "^7.1.3", "enqueue/enqueue": "^0.9", "queue-interop/queue-interop": "^0.7|^0.8", - "symfony/event-dispatcher": "^3.4|^4" + "symfony/event-dispatcher": "^4.3|^5" }, "require-dev": { - "phpunit/phpunit": "~5.5", - "symfony/dependency-injection": "^3.4|^4", - "symfony/config": "^3.4|^4", - "symfony/http-kernel": "^3.4|^4", - "symfony/filesystem": "^3.4|^4", + "phpunit/phpunit": "~7.5", + "symfony/dependency-injection": "^4.3|^5", + "symfony/config": "^4.3|^5", + "symfony/http-kernel": "^4.3|^5", + "symfony/filesystem": "^4.3|^5", + "symfony/yaml": "^4.3|^5", "enqueue/null": "0.9.x-dev", "enqueue/fs": "0.9.x-dev", "enqueue/test": "0.9.x-dev" @@ -29,7 +30,7 @@ "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md" }, "suggest": { - "symfony/dependency-injection": "^2.8|^3|^4 If you'd like to use async event dispatcher container extension." + "symfony/dependency-injection": "^2.8|^3|^4|^5 If you'd like to use async event dispatcher container extension." }, "autoload": { "psr-4": { "Enqueue\\AsyncEventDispatcher\\": "" }, diff --git a/pkg/async-event-dispatcher/phpunit.xml.dist b/pkg/async-event-dispatcher/phpunit.xml.dist index e64c86d98..b4c8fec08 100644 --- a/pkg/async-event-dispatcher/phpunit.xml.dist +++ b/pkg/async-event-dispatcher/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/dbal/Tests/DbalConsumerTest.php b/pkg/dbal/Tests/DbalConsumerTest.php index cca4d2380..add41a1df 100644 --- a/pkg/dbal/Tests/DbalConsumerTest.php +++ b/pkg/dbal/Tests/DbalConsumerTest.php @@ -15,6 +15,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Exception\InvalidMessageException; use Interop\Queue\Message; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Ramsey\Uuid\Uuid; @@ -175,7 +176,7 @@ public function testRejectShouldReSendMessageToSameQueueOnRequeue() $producerMock ->expects($this->once()) ->method('send') - ->with($this->identicalTo($queue), $this->isInstanceOf($message)) + ->with($this->identicalTo($queue), $this->isInstanceOf(DbalMessage::class)) ; $context = $this->createContextMock(); @@ -191,7 +192,7 @@ public function testRejectShouldReSendMessageToSameQueueOnRequeue() } /** - * @return DbalProducer|\PHPUnit_Framework_MockObject_MockObject + * @return DbalProducer|MockObject */ private function createProducerMock() { @@ -199,7 +200,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DbalContext + * @return MockObject|DbalContext */ private function createContextMock() { @@ -207,7 +208,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DbalContext + * @return MockObject|DbalContext */ private function createConectionMock() { @@ -219,6 +220,7 @@ class InvalidMessage implements Message { public function getBody(): string { + throw new \BadMethodCallException('This should not be called directly'); } public function setBody(string $body): void @@ -231,6 +233,7 @@ public function setProperties(array $properties): void public function getProperties(): array { + throw new \BadMethodCallException('This should not be called directly'); } public function setProperty(string $name, $value): void @@ -247,6 +250,7 @@ public function setHeaders(array $headers): void public function getHeaders(): array { + throw new \BadMethodCallException('This should not be called directly'); } public function setHeader(string $name, $value): void @@ -263,6 +267,7 @@ public function setRedelivered(bool $redelivered): void public function isRedelivered(): bool { + throw new \BadMethodCallException('This should not be called directly'); } public function setCorrelationId(string $correlationId = null): void @@ -271,6 +276,7 @@ public function setCorrelationId(string $correlationId = null): void public function getCorrelationId(): ?string { + throw new \BadMethodCallException('This should not be called directly'); } public function setMessageId(string $messageId = null): void @@ -279,10 +285,12 @@ public function setMessageId(string $messageId = null): void public function getMessageId(): ?string { + throw new \BadMethodCallException('This should not be called directly'); } public function getTimestamp(): ?int { + throw new \BadMethodCallException('This should not be called directly'); } public function setTimestamp(int $timestamp = null): void @@ -295,5 +303,6 @@ public function setReplyTo(string $replyTo = null): void public function getReplyTo(): ?string { + throw new \BadMethodCallException('This should not be called directly'); } } diff --git a/pkg/dbal/Tests/DbalContextTest.php b/pkg/dbal/Tests/DbalContextTest.php index 4c6e83184..b89abae2e 100644 --- a/pkg/dbal/Tests/DbalContextTest.php +++ b/pkg/dbal/Tests/DbalContextTest.php @@ -13,6 +13,7 @@ use Interop\Queue\Destination; use Interop\Queue\Exception\InvalidDestinationException; use Interop\Queue\Exception\TemporaryQueueNotSupportedException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DbalContextTest extends TestCase @@ -162,7 +163,7 @@ public function testShouldThrowBadMethodCallExceptionOncreateTemporaryQueueCall( } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Connection + * @return MockObject|Connection */ private function createConnectionMock() { diff --git a/pkg/dbal/Tests/DbalProducerTest.php b/pkg/dbal/Tests/DbalProducerTest.php index 59b2db746..4dcb015e3 100644 --- a/pkg/dbal/Tests/DbalProducerTest.php +++ b/pkg/dbal/Tests/DbalProducerTest.php @@ -9,6 +9,7 @@ use Interop\Queue\Destination; use Interop\Queue\Exception\InvalidDestinationException; use Interop\Queue\Producer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DbalProducerTest extends TestCase @@ -40,7 +41,7 @@ public function testShouldThrowIfDestinationOfInvalidType() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DbalContext + * @return MockObject|DbalContext */ private function createContextMock() { diff --git a/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php b/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php index 2f762c2eb..82787f19f 100644 --- a/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php +++ b/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php @@ -10,6 +10,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Queue; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DbalSubscriptionConsumerTest extends TestCase @@ -145,7 +146,7 @@ public function testThrowsIfTryConsumeWithoutSubscribers() } /** - * @return DbalContext|\PHPUnit_Framework_MockObject_MockObject + * @return DbalContext|MockObject */ private function createDbalContextMock() { @@ -155,7 +156,7 @@ private function createDbalContextMock() /** * @param mixed|null $queueName * - * @return Consumer|\PHPUnit_Framework_MockObject_MockObject + * @return Consumer|MockObject */ private function createConsumerStub($queueName = null) { diff --git a/pkg/dbal/Tests/Functional/DbalConsumerTest.php b/pkg/dbal/Tests/Functional/DbalConsumerTest.php index 686f87d16..69b644ed4 100644 --- a/pkg/dbal/Tests/Functional/DbalConsumerTest.php +++ b/pkg/dbal/Tests/Functional/DbalConsumerTest.php @@ -26,7 +26,7 @@ public function setUp() $this->context = $this->createDbalContext(); } - protected function tearDown() + protected function tearDown(): void { if ($this->context) { $this->context->close(); diff --git a/pkg/dbal/Tests/ManagerRegistryConnectionFactoryTest.php b/pkg/dbal/Tests/ManagerRegistryConnectionFactoryTest.php index 5bc2a5c41..953921b87 100644 --- a/pkg/dbal/Tests/ManagerRegistryConnectionFactoryTest.php +++ b/pkg/dbal/Tests/ManagerRegistryConnectionFactoryTest.php @@ -8,6 +8,7 @@ use Enqueue\Dbal\ManagerRegistryConnectionFactory; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\ConnectionFactory; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ManagerRegistryConnectionFactoryTest extends TestCase @@ -74,7 +75,7 @@ public function testShouldCreateLazyContext() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry + * @return MockObject|ManagerRegistry */ private function createManagerRegistryMock() { @@ -82,7 +83,7 @@ private function createManagerRegistryMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Connection + * @return MockObject|Connection */ private function createConnectionMock() { diff --git a/pkg/dbal/phpunit.xml.dist b/pkg/dbal/phpunit.xml.dist index 451d24a00..8b2213d34 100644 --- a/pkg/dbal/phpunit.xml.dist +++ b/pkg/dbal/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/dsn/phpunit.xml.dist b/pkg/dsn/phpunit.xml.dist index 21a14bbc3..8709cdcf6 100644 --- a/pkg/dsn/phpunit.xml.dist +++ b/pkg/dsn/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/enqueue-bundle/Consumption/Extension/DoctrinePingConnectionExtension.php b/pkg/enqueue-bundle/Consumption/Extension/DoctrinePingConnectionExtension.php index ab8c70f2d..88453e77c 100644 --- a/pkg/enqueue-bundle/Consumption/Extension/DoctrinePingConnectionExtension.php +++ b/pkg/enqueue-bundle/Consumption/Extension/DoctrinePingConnectionExtension.php @@ -2,22 +2,19 @@ namespace Enqueue\Bundle\Consumption\Extension; +use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\DBAL\Connection; use Enqueue\Consumption\Context\MessageReceived; use Enqueue\Consumption\MessageReceivedExtensionInterface; -use Symfony\Bridge\Doctrine\RegistryInterface; class DoctrinePingConnectionExtension implements MessageReceivedExtensionInterface { /** - * @var RegistryInterface + * @var ManagerRegistry */ protected $registry; - /** - * @param RegistryInterface $registry - */ - public function __construct(RegistryInterface $registry) + public function __construct(ManagerRegistry $registry) { $this->registry = $registry; } diff --git a/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php b/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php new file mode 100644 index 000000000..a63e75431 --- /dev/null +++ b/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php @@ -0,0 +1,97 @@ +producers[$name] = $producer; + } + + public function getCount(): int + { + $count = 0; + foreach ($this->data as $name => $messages) { + $count += count($messages); + } + + return $count; + } + + /** + * @return array + */ + public function getSentMessages() + { + return $this->data; + } + + /** + * @param string $priority + * + * @return string + */ + public function prettyPrintPriority($priority) + { + $map = [ + MessagePriority::VERY_LOW => 'very low', + MessagePriority::LOW => 'low', + MessagePriority::NORMAL => 'normal', + MessagePriority::HIGH => 'high', + MessagePriority::VERY_HIGH => 'very high', + ]; + + return isset($map[$priority]) ? $map[$priority] : $priority; + } + + /** + * @param mixed $body + * + * @return string + */ + public function ensureString($body) + { + return is_string($body) ? $body : JSON::encode($body); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'enqueue.message_queue'; + } + + /** + * {@inheritdoc} + */ + public function reset() + { + $this->data = []; + } + + protected function collectInternal(Request $request, Response $response): void + { + $this->data = []; + + foreach ($this->producers as $name => $producer) { + if ($producer instanceof TraceableProducer) { + $this->data[$name] = $producer->getTraces(); + } + } + } +} diff --git a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php index 0c369da94..e44429413 100644 --- a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php +++ b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php @@ -2,99 +2,30 @@ namespace Enqueue\Bundle\Profiler; -use Enqueue\Client\MessagePriority; -use Enqueue\Client\ProducerInterface; -use Enqueue\Client\TraceableProducer; -use Enqueue\Util\JSON; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\Kernel; -class MessageQueueCollector extends DataCollector -{ - /** - * @var ProducerInterface - */ - private $producers; - - public function addProducer(string $name, ProducerInterface $producer): void - { - $this->producers[$name] = $producer; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) +if (Kernel::MAJOR_VERSION < 5) { + class MessageQueueCollector extends AbstractMessageQueueCollector { - $this->data = []; - - foreach ($this->producers as $name => $producer) { - if ($producer instanceof TraceableProducer) { - $this->data[$name] = $producer->getTraces(); - } + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Exception $exception = null) + { + $this->collectInternal($request, $response); } } - - public function getCount(): int +} else { + class MessageQueueCollector extends AbstractMessageQueueCollector { - $count = 0; - foreach ($this->data as $name => $messages) { - $count += count($messages); + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Throwable $exception = null) + { + $this->collectInternal($request, $response); } - - return $count; - } - - /** - * @return array - */ - public function getSentMessages() - { - return $this->data; - } - - /** - * @param string $priority - * - * @return string - */ - public function prettyPrintPriority($priority) - { - $map = [ - MessagePriority::VERY_LOW => 'very low', - MessagePriority::LOW => 'low', - MessagePriority::NORMAL => 'normal', - MessagePriority::HIGH => 'high', - MessagePriority::VERY_HIGH => 'very high', - ]; - - return isset($map[$priority]) ? $map[$priority] : $priority; - } - - /** - * @param mixed $body - * - * @return string - */ - public function ensureString($body) - { - return is_string($body) ? $body : JSON::encode($body); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'enqueue.message_queue'; - } - - /** - * {@inheritdoc} - */ - public function reset() - { - $this->data = []; } } diff --git a/pkg/enqueue-bundle/Tests/Functional/App/AbstractAsyncListener.php b/pkg/enqueue-bundle/Tests/Functional/App/AbstractAsyncListener.php new file mode 100644 index 000000000..acf7406e1 --- /dev/null +++ b/pkg/enqueue-bundle/Tests/Functional/App/AbstractAsyncListener.php @@ -0,0 +1,48 @@ +producer = $producer; + $this->registry = $registry; + } + + /** + * @param Event|ContractEvent $event + * @param string $eventName + */ + protected function onEventInternal($event, $eventName) + { + if (false == $this->isSyncMode($eventName)) { + $transformerName = $this->registry->getTransformerNameForEvent($eventName); + + $interopMessage = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event); + $message = new Message($interopMessage->getBody()); + $message->setScope(Message::SCOPE_APP); + $message->setProperty('event_name', $eventName); + $message->setProperty('transformer_name', $transformerName); + + $this->producer->sendCommand(Commands::DISPATCH_ASYNC_EVENTS, $message); + } + } +} diff --git a/pkg/enqueue-bundle/Tests/Functional/App/AsyncListener.php b/pkg/enqueue-bundle/Tests/Functional/App/AsyncListener.php index 9e94c2c6f..2248dc5d1 100644 --- a/pkg/enqueue-bundle/Tests/Functional/App/AsyncListener.php +++ b/pkg/enqueue-bundle/Tests/Functional/App/AsyncListener.php @@ -2,50 +2,36 @@ namespace Enqueue\Bundle\Tests\Functional\App; -use Enqueue\AsyncEventDispatcher\Commands; -use Enqueue\AsyncEventDispatcher\Registry; -use Enqueue\Client\Message; -use Enqueue\Client\ProducerInterface; use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event as ContractEvent; -class AsyncListener extends \Enqueue\AsyncEventDispatcher\AsyncListener -{ +if (class_exists(Event::class)) { /** - * @var ProducerInterface + * Symfony < 5.0. */ - private $producer; - - /** - * @var Registry - */ - private $registry; - - /** - * @param ProducerInterface $producer - * @param Registry $registry - */ - public function __construct(ProducerInterface $producer, Registry $registry) + class AsyncListener extends AbstractAsyncListener { - $this->producer = $producer; - $this->registry = $registry; + /** + * @param Event|ContractEvent $event + * @param string $eventName + */ + public function onEvent($event, $eventName) + { + $this->onEventInternal($event, $eventName); + } } - +} else { /** - * @param Event $event - * @param string $eventName + * Symfony >= 5.0. */ - public function onEvent(Event $event = null, $eventName) + class AsyncListener extends AbstractAsyncListener { - if (false == $this->isSyncMode($eventName)) { - $transformerName = $this->registry->getTransformerNameForEvent($eventName); - - $interopMessage = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event); - $message = new Message($interopMessage->getBody()); - $message->setScope(Message::SCOPE_APP); - $message->setProperty('event_name', $eventName); - $message->setProperty('transformer_name', $transformerName); - - $this->producer->sendCommand(Commands::DISPATCH_ASYNC_EVENTS, $message); + /** + * @param string $eventName + */ + public function onEvent(ContractEvent $event, $eventName) + { + $this->onEventInternal($event, $eventName); } } } diff --git a/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncEventTransformer.php b/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncEventTransformer.php index 4293ab85e..7c85e076c 100644 --- a/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncEventTransformer.php +++ b/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncEventTransformer.php @@ -8,47 +8,94 @@ use Interop\Queue\Message; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\GenericEvent; +use Symfony\Contracts\EventDispatcher\Event as ContractEvent; -class TestAsyncEventTransformer implements EventTransformer -{ +if (class_exists(Event::class)) { /** - * @var Context + * Symfony < 5.0. */ - private $context; + class TestAsyncEventTransformer implements EventTransformer + { + /** + * @var Context + */ + private $context; + + public function __construct(Context $context) + { + $this->context = $context; + } + + public function toMessage($eventName, $event = null) + { + if (Event::class === get_class($event) || ContractEvent::class === get_class($event)) { + return $this->context->createMessage(json_encode('')); + } + + /** @var GenericEvent $event */ + if (false == $event instanceof GenericEvent) { + throw new \LogicException('Must be GenericEvent'); + } + + return $this->context->createMessage(json_encode([ + 'subject' => $event->getSubject(), + 'arguments' => $event->getArguments(), + ])); + } + + public function toEvent($eventName, Message $message) + { + $data = JSON::decode($message->getBody()); + + if ('' === $data) { + return new Event(); + } + return new GenericEvent($data['subject'], $data['arguments']); + } + } +} else { /** - * @param Context $context + * Symfony >= 5.0. */ - public function __construct(Context $context) + class TestAsyncEventTransformer implements EventTransformer { - $this->context = $context; - } + /** + * @var Context + */ + private $context; - public function toMessage($eventName, Event $event = null) - { - if (Event::class === get_class($event)) { - return $this->context->createMessage(json_encode('')); + public function __construct(Context $context) + { + $this->context = $context; } - /** @var GenericEvent $event */ - if (false == $event instanceof GenericEvent) { - throw new \LogicException('Must be GenericEvent'); + public function toMessage($eventName, ContractEvent $event = null) + { + if (ContractEvent::class === get_class($event)) { + return $this->context->createMessage(json_encode('')); + } + + /** @var GenericEvent $event */ + if (false == $event instanceof GenericEvent) { + throw new \LogicException('Must be GenericEvent'); + } + + return $this->context->createMessage(json_encode([ + 'subject' => $event->getSubject(), + 'arguments' => $event->getArguments(), + ])); } - return $this->context->createMessage(json_encode([ - 'subject' => $event->getSubject(), - 'arguments' => $event->getArguments(), - ])); - } + public function toEvent($eventName, Message $message) + { + $data = JSON::decode($message->getBody()); - public function toEvent($eventName, Message $message) - { - $data = JSON::decode($message->getBody()); + if ('' === $data) { + return new ContractEvent(); + } - if ('' === $data) { - return new Event(); + return new GenericEvent($data['subject'], $data['arguments']); } - - return new GenericEvent($data['subject'], $data['arguments']); } } diff --git a/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncListener.php b/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncListener.php index aa4884bca..fd0ec1d91 100644 --- a/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncListener.php +++ b/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncListener.php @@ -2,14 +2,13 @@ namespace Enqueue\Bundle\Tests\Functional\App; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class TestAsyncListener { public $calls = []; - public function onEvent(Event $event, $eventName, EventDispatcherInterface $dispatcher) + public function onEvent($event, $eventName, EventDispatcherInterface $dispatcher) { $this->calls[] = func_get_args(); } diff --git a/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncSubscriber.php b/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncSubscriber.php index 2b45bed6e..cd3beb45b 100644 --- a/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncSubscriber.php +++ b/pkg/enqueue-bundle/Tests/Functional/App/TestAsyncSubscriber.php @@ -2,7 +2,6 @@ namespace Enqueue\Bundle\Tests\Functional\App; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -10,7 +9,7 @@ class TestAsyncSubscriber implements EventSubscriberInterface { public $calls = []; - public function onEvent(Event $event, $eventName, EventDispatcherInterface $dispatcher) + public function onEvent($event, $eventName, EventDispatcherInterface $dispatcher) { $this->calls[] = func_get_args(); } diff --git a/pkg/enqueue-bundle/Tests/Functional/App/config/config.yml b/pkg/enqueue-bundle/Tests/Functional/App/config/config.yml index 562647c31..7b04a3f30 100644 --- a/pkg/enqueue-bundle/Tests/Functional/App/config/config.yml +++ b/pkg/enqueue-bundle/Tests/Functional/App/config/config.yml @@ -8,11 +8,10 @@ framework: #translator: { fallback: "%locale%" } test: ~ assets: false - templating: false session: storage_id: session.storage.mock_file secret: '%secret%' - router: { resource: '%kernel.root_dir%/config/routing.yml' } + router: { resource: '%kernel.project_dir%/config/routing.yml' } default_locale: '%locale%' doctrine: diff --git a/pkg/enqueue-bundle/Tests/Functional/App/config/custom-config.yml b/pkg/enqueue-bundle/Tests/Functional/App/config/custom-config.yml index eda14e00c..37c4660a0 100644 --- a/pkg/enqueue-bundle/Tests/Functional/App/config/custom-config.yml +++ b/pkg/enqueue-bundle/Tests/Functional/App/config/custom-config.yml @@ -7,11 +7,10 @@ framework: #translator: { fallback: "%locale%" } test: ~ assets: false - templating: false session: storage_id: session.storage.mock_file secret: '%secret%' - router: { resource: '%kernel.root_dir%/config/routing.yml' } + router: { resource: '%kernel.project_dir%/config/routing.yml' } default_locale: '%locale%' doctrine: @@ -82,4 +81,4 @@ services: test.sqs_custom_connection_factory_factory: class: 'Enqueue\Bundle\Tests\Functional\App\SqsCustomConnectionFactoryFactory' - arguments: ['@service_container'] \ No newline at end of file + arguments: ['@service_container'] diff --git a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php index 6e952ab28..457a0ffcd 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php @@ -33,7 +33,7 @@ public function testShouldNotCallRealListenerIfMarkedAsAsync() /** @var EventDispatcherInterface $dispatcher */ $dispatcher = static::$container->get('event_dispatcher'); - $dispatcher->dispatch('test_async', new GenericEvent('aSubject')); + $this->dispatch($dispatcher, new GenericEvent('aSubject'), 'test_async'); /** @var TestAsyncListener $listener */ $listener = static::$container->get('test_async_listener'); @@ -48,7 +48,7 @@ public function testShouldSendMessageToExpectedCommandInsteadOfCallingRealListen $event = new GenericEvent('theSubject', ['fooArg' => 'fooVal']); - $dispatcher->dispatch('test_async', $event); + $this->dispatch($dispatcher, $event, 'test_async'); /** @var TraceableProducer $producer */ $producer = static::$container->get('test_enqueue.client.default.producer'); @@ -66,9 +66,9 @@ public function testShouldSendMessageForEveryDispatchCall() /** @var EventDispatcherInterface $dispatcher */ $dispatcher = static::$container->get('event_dispatcher'); - $dispatcher->dispatch('test_async', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); - $dispatcher->dispatch('test_async', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); - $dispatcher->dispatch('test_async', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async'); + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async'); + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async'); /** @var TraceableProducer $producer */ $producer = static::$container->get('test_enqueue.client.default.producer'); @@ -84,11 +84,11 @@ public function testShouldSendMessageIfDispatchedFromInsideListener() $dispatcher = static::$container->get('event_dispatcher'); $eventName = 'an_event_'.uniqid(); - $dispatcher->addListener($eventName, function (Event $event, $eventName, EventDispatcherInterface $dispatcher) { - $dispatcher->dispatch('test_async', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); + $dispatcher->addListener($eventName, function ($event, $eventName, EventDispatcherInterface $dispatcher) { + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async'); }); - $dispatcher->dispatch($eventName); + $this->dispatch($dispatcher, new GenericEvent(), $eventName); /** @var TraceableProducer $producer */ $producer = static::$container->get('test_enqueue.client.default.producer'); @@ -97,4 +97,15 @@ public function testShouldSendMessageIfDispatchedFromInsideListener() $this->assertCount(1, $traces); } + + private function dispatch(EventDispatcherInterface $dispatcher, $event, $eventName): void + { + if (!class_exists(Event::class)) { + // Symfony 5 + $dispatcher->dispatch($event, $eventName); + } else { + // Symfony < 5 + $dispatcher->dispatch($eventName, $event); + } + } } diff --git a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php index 6e00eafca..7404e6af8 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php @@ -33,7 +33,7 @@ public function testShouldNotCallRealSubscriberIfMarkedAsAsync() /** @var EventDispatcherInterface $dispatcher */ $dispatcher = static::$container->get('event_dispatcher'); - $dispatcher->dispatch('test_async_subscriber', new GenericEvent('aSubject')); + $this->dispatch($dispatcher, new GenericEvent('aSubject'), 'test_async_subscriber'); /** @var TestAsyncSubscriber $listener */ $listener = static::$container->get('test_async_subscriber'); @@ -48,7 +48,7 @@ public function testShouldSendMessageToExpectedTopicInsteadOfCallingRealSubscrib $event = new GenericEvent('theSubject', ['fooArg' => 'fooVal']); - $dispatcher->dispatch('test_async_subscriber', $event); + $this->dispatch($dispatcher, $event, 'test_async_subscriber'); /** @var TraceableProducer $producer */ $producer = static::$container->get('test_enqueue.client.default.producer'); @@ -66,9 +66,9 @@ public function testShouldSendMessageForEveryDispatchCall() /** @var EventDispatcherInterface $dispatcher */ $dispatcher = static::$container->get('event_dispatcher'); - $dispatcher->dispatch('test_async_subscriber', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); - $dispatcher->dispatch('test_async_subscriber', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); - $dispatcher->dispatch('test_async_subscriber', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async_subscriber'); + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async_subscriber'); + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async_subscriber'); /** @var TraceableProducer $producer */ $producer = static::$container->get('test_enqueue.client.default.producer'); @@ -84,11 +84,11 @@ public function testShouldSendMessageIfDispatchedFromInsideListener() $dispatcher = static::$container->get('event_dispatcher'); $eventName = 'anEvent'.uniqid(); - $dispatcher->addListener($eventName, function (Event $event, $eventName, EventDispatcherInterface $dispatcher) { - $dispatcher->dispatch('test_async_subscriber', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); + $dispatcher->addListener($eventName, function ($event, $eventName, EventDispatcherInterface $dispatcher) { + $this->dispatch($dispatcher, new GenericEvent('theSubject', ['fooArg' => 'fooVal']), 'test_async_subscriber'); }); - $dispatcher->dispatch($eventName); + $this->dispatch($dispatcher, new GenericEvent(), $eventName); /** @var TraceableProducer $producer */ $producer = static::$container->get('test_enqueue.client.default.producer'); @@ -97,4 +97,15 @@ public function testShouldSendMessageIfDispatchedFromInsideListener() $this->assertCount(1, $traces); } + + private function dispatch(EventDispatcherInterface $dispatcher, $event, $eventName): void + { + if (!class_exists(Event::class)) { + // Symfony 5 + $dispatcher->dispatch($event, $eventName); + } else { + // Symfony < 5 + $dispatcher->dispatch($eventName, $event); + } + } } diff --git a/pkg/enqueue-bundle/Tests/Functional/LazyProducerTest.php b/pkg/enqueue-bundle/Tests/Functional/LazyProducerTest.php index cf9af030e..fefbe882b 100644 --- a/pkg/enqueue-bundle/Tests/Functional/LazyProducerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/LazyProducerTest.php @@ -17,7 +17,7 @@ public function setUp() // parent::setUp(); } - public function tearDown() + public function tearDown(): void { if (static::$kernel) { $fs = new Filesystem(); diff --git a/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php b/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php index f4f11abb1..37b6e1b57 100644 --- a/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php @@ -24,7 +24,7 @@ public function setUp() // parent::setUp(); } - public function tearDown() + public function tearDown(): void { if ($this->getContext()) { $this->getContext()->close(); diff --git a/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php b/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php index 2b4f58173..8e3569a98 100644 --- a/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php +++ b/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php @@ -33,11 +33,10 @@ protected function setUp() $producer->clearTraces(); } - protected function tearDown() + protected function tearDown(): void { + static::ensureKernelShutdown(); static::$client = null; - static::$kernel = null; - static::$container = null; } /** diff --git a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php index 47dceeb36..852960458 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php @@ -10,6 +10,7 @@ use Interop\Queue\Context as InteropContext; use Interop\Queue\Message; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -59,7 +60,7 @@ protected function createContext(): MessageReceived } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry + * @return MockObject|ManagerRegistry */ protected function createRegistryMock(): ManagerRegistry { @@ -67,7 +68,7 @@ protected function createRegistryMock(): ManagerRegistry } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ObjectManager + * @return MockObject|ObjectManager */ protected function createManagerMock(): ObjectManager { diff --git a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClosedEntityManagerExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClosedEntityManagerExtensionTest.php index 1cccb0b13..59587adfb 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClosedEntityManagerExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClosedEntityManagerExtensionTest.php @@ -12,6 +12,7 @@ use Interop\Queue\Context as InteropContext; use Interop\Queue\Message; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -189,7 +190,7 @@ public function testOnPostReceivedShouldInterruptExecutionIfAManagerIsClosed() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry + * @return MockObject|ManagerRegistry */ protected function createRegistryMock(array $managers): ManagerRegistry { @@ -205,7 +206,7 @@ protected function createRegistryMock(array $managers): ManagerRegistry } /** - * @return \PHPUnit_Framework_MockObject_MockObject|EntityManagerInterface + * @return MockObject|EntityManagerInterface */ protected function createManagerMock(bool $open): EntityManagerInterface { diff --git a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php index e38c34d52..829882d4f 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php @@ -2,6 +2,7 @@ namespace Enqueue\Bundle\Tests\Unit\Consumption\Extension; +use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\DBAL\Connection; use Enqueue\Bundle\Consumption\Extension\DoctrinePingConnectionExtension; use Enqueue\Consumption\Context\MessageReceived; @@ -9,9 +10,9 @@ use Interop\Queue\Context as InteropContext; use Interop\Queue\Message; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use Symfony\Bridge\Doctrine\RegistryInterface; class DoctrinePingConnectionExtensionTest extends TestCase { @@ -160,15 +161,15 @@ protected function createContext(): MessageReceived } /** - * @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface + * @return MockObject|ManagerRegistry */ - protected function createRegistryMock(): RegistryInterface + protected function createRegistryMock() { - return $this->createMock(RegistryInterface::class); + return $this->createMock(ManagerRegistry::class); } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Connection + * @return MockObject|Connection */ protected function createConnectionMock(): Connection { diff --git a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/ResetServicesExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/ResetServicesExtensionTest.php index e5f787420..8fbe29791 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/ResetServicesExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/ResetServicesExtensionTest.php @@ -9,6 +9,7 @@ use Interop\Queue\Context as InteropContext; use Interop\Queue\Message; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; @@ -52,7 +53,7 @@ protected function createContext(): MessageReceived } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry + * @return MockObject|ManagerRegistry */ protected function createResetterMock(): ServicesResetter { diff --git a/pkg/enqueue-bundle/Tests/Unit/Profiler/MessageQueueCollectorTest.php b/pkg/enqueue-bundle/Tests/Unit/Profiler/MessageQueueCollectorTest.php index 4ad12f718..96d4bc940 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Profiler/MessageQueueCollectorTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Profiler/MessageQueueCollectorTest.php @@ -7,6 +7,7 @@ use Enqueue\Client\ProducerInterface; use Enqueue\Client\TraceableProducer; use Enqueue\Test\ClassExtensionTrait; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -138,7 +139,7 @@ public function testShouldEnsureStringEncodeArrayToJson() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return MockObject|ProducerInterface */ protected function createProducerMock() { @@ -146,7 +147,7 @@ protected function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|TraceableProducer + * @return MockObject|TraceableProducer */ protected function createTraceableProducerMock() { diff --git a/pkg/enqueue-bundle/composer.json b/pkg/enqueue-bundle/composer.json index 49a637ab3..75e6c1e94 100644 --- a/pkg/enqueue-bundle/composer.json +++ b/pkg/enqueue-bundle/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": "^7.1.3", - "symfony/framework-bundle": "^3.4|^4", + "symfony/framework-bundle": "^4.3|^5", "queue-interop/amqp-interop": "^0.8", "queue-interop/queue-interop": "^0.7|^0.8", "enqueue/enqueue": "^0.9", @@ -21,7 +21,7 @@ "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md" }, "require-dev": { - "phpunit/phpunit": "~5.5", + "phpunit/phpunit": "~7.5", "enqueue/stomp": "0.9.x-dev", "enqueue/amqp-ext": "0.9.x-dev", "enqueue/amqp-lib": "0.9.x-dev", @@ -36,11 +36,12 @@ "enqueue/async-event-dispatcher": "0.9.x-dev", "enqueue/async-command": "0.9.x-dev", "php-amqplib/php-amqplib": "^2.7", - "doctrine/doctrine-bundle": "~1.2", - "doctrine/mongodb-odm-bundle": "^3.5", + "doctrine/doctrine-bundle": "~1.2|^2", + "doctrine/mongodb-odm-bundle": "^3.5|^4", "alcaeus/mongo-php-adapter": "^1.0", - "symfony/browser-kit": "^3.4|^4", - "symfony/expression-language": "^3.4|^4" + "symfony/browser-kit": "^4.3|^5", + "symfony/expression-language": "^4.3|^5", + "symfony/yaml": "^4.3|^5" }, "suggest": { "enqueue/async-command": "If want to run Symfony command via message queue", diff --git a/pkg/enqueue-bundle/phpunit.xml.dist b/pkg/enqueue-bundle/phpunit.xml.dist index ac0770ea9..9058a1c0c 100644 --- a/pkg/enqueue-bundle/phpunit.xml.dist +++ b/pkg/enqueue-bundle/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/enqueue/Doctrine/DoctrineConnectionFactoryFactory.php b/pkg/enqueue/Doctrine/DoctrineConnectionFactoryFactory.php index db8f0dd76..b6e684cdd 100644 --- a/pkg/enqueue/Doctrine/DoctrineConnectionFactoryFactory.php +++ b/pkg/enqueue/Doctrine/DoctrineConnectionFactoryFactory.php @@ -2,16 +2,16 @@ namespace Enqueue\Doctrine; +use Doctrine\Common\Persistence\ManagerRegistry; use Enqueue\ConnectionFactoryFactoryInterface; use Enqueue\Dbal\ManagerRegistryConnectionFactory; use Enqueue\Dsn\Dsn; use Interop\Queue\ConnectionFactory; -use Symfony\Bridge\Doctrine\RegistryInterface; class DoctrineConnectionFactoryFactory implements ConnectionFactoryFactoryInterface { /** - * @var RegistryInterface + * @var ManagerRegistry */ private $doctrine; @@ -20,7 +20,7 @@ class DoctrineConnectionFactoryFactory implements ConnectionFactoryFactoryInterf */ private $fallbackFactory; - public function __construct(RegistryInterface $doctrine, ConnectionFactoryFactoryInterface $fallbackFactory) + public function __construct(ManagerRegistry $doctrine, ConnectionFactoryFactoryInterface $fallbackFactory) { $this->doctrine = $doctrine; $this->fallbackFactory = $fallbackFactory; diff --git a/pkg/enqueue/Symfony/Client/ConsumeCommand.php b/pkg/enqueue/Symfony/Client/ConsumeCommand.php index fee54e1b5..4b65f6276 100644 --- a/pkg/enqueue/Symfony/Client/ConsumeCommand.php +++ b/pkg/enqueue/Symfony/Client/ConsumeCommand.php @@ -87,7 +87,7 @@ protected function configure(): void ; } - protected function execute(InputInterface $input, OutputInterface $output): ?int + protected function execute(InputInterface $input, OutputInterface $output): int { $client = $input->getOption('client'); @@ -122,11 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int $queues = []; foreach ($selectedQueues as $queue) { if (false == array_key_exists($queue, $allQueues)) { - throw new \LogicException(sprintf( - 'There is no such queue "%s". Available are "%s"', - $queue, - implode('", "', array_keys($allQueues)) - )); + throw new \LogicException(sprintf('There is no such queue "%s". Available are "%s"', $queue, implode('", "', array_keys($allQueues)))); } $queues[$queue] = $allQueues[$queue]; @@ -147,7 +143,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int $consumer->consume(new ChainExtension([$runtimeExtensionChain, $exitStatusExtension])); - return $exitStatusExtension->getExitStatus(); + return $exitStatusExtension->getExitStatus() ?? 0; } protected function getRuntimeExtensions(InputInterface $input, OutputInterface $output): ExtensionInterface diff --git a/pkg/enqueue/Symfony/Client/ProduceCommand.php b/pkg/enqueue/Symfony/Client/ProduceCommand.php index 51a365967..667871c71 100644 --- a/pkg/enqueue/Symfony/Client/ProduceCommand.php +++ b/pkg/enqueue/Symfony/Client/ProduceCommand.php @@ -52,7 +52,7 @@ protected function configure(): void ; } - protected function execute(InputInterface $input, OutputInterface $output): ?int + protected function execute(InputInterface $input, OutputInterface $output): int { $topic = $input->getOption('topic'); $command = $input->getOption('command'); @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int throw new \LogicException('Either topic or command option should be set, none is set.'); } - return null; + return 0; } private function getProducer(string $client): ProducerInterface diff --git a/pkg/enqueue/Symfony/Client/RoutesCommand.php b/pkg/enqueue/Symfony/Client/RoutesCommand.php index 04d404d85..5419f3beb 100644 --- a/pkg/enqueue/Symfony/Client/RoutesCommand.php +++ b/pkg/enqueue/Symfony/Client/RoutesCommand.php @@ -58,7 +58,7 @@ protected function configure(): void $this->driver = null; } - protected function execute(InputInterface $input, OutputInterface $output): ?int + protected function execute(InputInterface $input, OutputInterface $output): int { try { $this->driver = $this->getDriver($input->getOption('client')); @@ -112,7 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int $table->render(); } - return null; + return 0; } private function formatSourceType(Route $route): string diff --git a/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php b/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php index 72215a8ba..65d52ee31 100644 --- a/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php +++ b/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php @@ -48,7 +48,7 @@ protected function configure(): void ; } - protected function execute(InputInterface $input, OutputInterface $output): ?int + protected function execute(InputInterface $input, OutputInterface $output): int { $client = $input->getOption('client'); @@ -60,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int $output->writeln('Broker set up'); - return null; + return 0; } private function getDriver(string $client): DriverInterface diff --git a/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php b/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php index 9c47134a0..9ec8a36f3 100644 --- a/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php +++ b/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php @@ -72,7 +72,7 @@ protected function configure(): void ; } - protected function execute(InputInterface $input, OutputInterface $output): ?int + protected function execute(InputInterface $input, OutputInterface $output): int { $transport = $input->getOption('transport'); @@ -92,10 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int } if (empty($queues)) { - throw new \LogicException(sprintf( - 'The queue is not provided. The processor must implement "%s" interface and it must return not empty array of queues or a queue set using as a second argument.', - QueueSubscriberInterface::class - )); + throw new \LogicException(sprintf('The queue is not provided. The processor must implement "%s" interface and it must return not empty array of queues or a queue set using as a second argument.', QueueSubscriberInterface::class)); } $extensions = $this->getLimitsExtensions($input, $output); @@ -110,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int $consumer->consume(new ChainExtension($extensions)); - return null; + return 0; } private function getQueueConsumer(string $name): QueueConsumerInterface diff --git a/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php b/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php index b10d19f68..b1a54c163 100644 --- a/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php +++ b/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php @@ -57,7 +57,7 @@ protected function configure(): void ; } - protected function execute(InputInterface $input, OutputInterface $output): ?int + protected function execute(InputInterface $input, OutputInterface $output): int { $transport = $input->getOption('transport'); @@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int $consumer->consume(new ChainExtension($extensions)); - return $exitStatusExtension->getExitStatus(); + return $exitStatusExtension->getExitStatus() ?? 0; } private function getQueueConsumer(string $name): QueueConsumerInterface diff --git a/pkg/enqueue/Tests/ArrayProcessorRegistryTest.php b/pkg/enqueue/Tests/ArrayProcessorRegistryTest.php index 50c802582..897276d62 100644 --- a/pkg/enqueue/Tests/ArrayProcessorRegistryTest.php +++ b/pkg/enqueue/Tests/ArrayProcessorRegistryTest.php @@ -6,6 +6,7 @@ use Enqueue\ProcessorRegistryInterface; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ArrayProcessorRegistryTest extends TestCase @@ -51,7 +52,7 @@ public function testShouldAllowGetProcessorAddedViaAddMethod() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Processor + * @return MockObject|Processor */ protected function createProcessorMock() { diff --git a/pkg/enqueue/Tests/Client/ChainExtensionTest.php b/pkg/enqueue/Tests/Client/ChainExtensionTest.php index 95f314423..a59005bc1 100644 --- a/pkg/enqueue/Tests/Client/ChainExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ChainExtensionTest.php @@ -151,7 +151,7 @@ public function testShouldProxyOnPostSentToAllInternalExtensions() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ExtensionInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ExtensionInterface */ protected function createExtension() { diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php index 9c8c24439..050b4f2f5 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php @@ -15,6 +15,7 @@ use Interop\Queue\Destination; use Interop\Queue\Message as TransportMessage; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -144,7 +145,7 @@ public function testShouldDoNothingIfMessageIsRedeliveredButResultWasAlreadySetO } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createDriverMock(): DriverInterface { @@ -152,7 +153,7 @@ private function createDriverMock(): DriverInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createContextMock(): InteropContext { @@ -160,7 +161,7 @@ private function createContextMock(): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createProcessorMock(): Processor { @@ -170,7 +171,7 @@ private function createProcessorMock(): Processor /** * @param mixed $queue * - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createConsumerStub($queue): Consumer { @@ -185,7 +186,7 @@ private function createConsumerStub($queue): Consumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createLoggerMock(): LoggerInterface { diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php index 877836758..878778b30 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php @@ -15,6 +15,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Context as InteropContext; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -242,7 +243,7 @@ public function testShouldDoNothingIfAnotherQueue() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createDriverStub(RouteCollection $routeCollection = null): DriverInterface { @@ -257,7 +258,7 @@ private function createDriverStub(RouteCollection $routeCollection = null): Driv } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createContextMock(): InteropContext { @@ -265,7 +266,7 @@ private function createContextMock(): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createProcessorMock(): Processor { @@ -275,7 +276,7 @@ private function createProcessorMock(): Processor /** * @param mixed $queue * - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createConsumerStub($queue): Consumer { diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/FlushSpoolProducerExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/FlushSpoolProducerExtensionTest.php index 53d88aa8d..63fb50c5a 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/FlushSpoolProducerExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/FlushSpoolProducerExtensionTest.php @@ -12,6 +12,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Context; use Interop\Queue\Message; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -70,7 +71,7 @@ public function testShouldFlushSpoolProducerOnPostReceived() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createInteropContextMock(): Context { @@ -78,7 +79,7 @@ private function createInteropContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SpoolProducer + * @return MockObject|SpoolProducer */ private function createSpoolProducerMock() { diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php index 0bd6514d8..063ea23af 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php @@ -21,6 +21,7 @@ use Interop\Queue\Context; use Interop\Queue\Processor; use Interop\Queue\Queue; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; @@ -500,7 +501,7 @@ public function testShouldLogProcessedTopicProcessorMessageWithReasonResultObjec } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createConsumerStub(Queue $queue): Consumer { @@ -515,7 +516,7 @@ private function createConsumerStub(Queue $queue): Consumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createContextMock(): Context { @@ -523,7 +524,7 @@ private function createContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createProcessorMock(): Processor { @@ -531,7 +532,7 @@ private function createProcessorMock(): Processor } /** - * @return \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @return MockObject|LoggerInterface */ private function createLogger() { diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php index 3c12de4f9..18760e9bf 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php @@ -13,6 +13,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Context as InteropContext; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -161,7 +162,7 @@ public function testShouldSkipMessagesWithoutTopicPropertySet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropContext + * @return MockObject|InteropContext */ protected function createContextMock(): InteropContext { @@ -169,7 +170,7 @@ protected function createContextMock(): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DriverInterface + * @return MockObject|DriverInterface */ protected function createDriverMock(): DriverInterface { @@ -177,7 +178,7 @@ protected function createDriverMock(): DriverInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createProcessorMock(): Processor { @@ -187,7 +188,7 @@ private function createProcessorMock(): Processor /** * @param mixed $queue * - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createConsumerStub($queue): Consumer { diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetupBrokerExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetupBrokerExtensionTest.php index 014c23289..4b241aa0e 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetupBrokerExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetupBrokerExtensionTest.php @@ -8,6 +8,7 @@ use Enqueue\Consumption\StartExtensionInterface; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context as InteropContext; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -61,7 +62,7 @@ public function testShouldSetupBrokerOnlyOnce() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DriverInterface + * @return MockObject|DriverInterface */ private function createDriverMock() { diff --git a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php index 4fe6bd570..40ef17989 100644 --- a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php +++ b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php @@ -8,6 +8,7 @@ use Enqueue\ProcessorRegistryInterface; use Interop\Queue\Context; use Interop\Queue\Processor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DelegateProcessorTest extends TestCase @@ -57,7 +58,7 @@ public function testShouldProcessMessage() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProcessorRegistryInterface + * @return MockObject|ProcessorRegistryInterface */ protected function createProcessorRegistryMock() { @@ -65,7 +66,7 @@ protected function createProcessorRegistryMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return MockObject|Context */ protected function createContextMock() { @@ -73,7 +74,7 @@ protected function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Processor + * @return MockObject|Processor */ protected function createProcessorMock() { diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php index cb141372b..4f1c81566 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTestsTrait.php @@ -1124,12 +1124,12 @@ public function testThrowIfNeitherTopicNorCommandAreSentOnSendToProcessor() abstract protected function createDriver(...$args): DriverInterface; /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ abstract protected function createContextMock(): Context; /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ abstract protected function createProducerMock(): InteropProducer; @@ -1140,7 +1140,7 @@ abstract protected function createTopic(string $name): InteropTopic; abstract protected function createMessage(): InteropMessage; /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ protected function createContextStub(): Context { diff --git a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php index 1378dd3a2..a55fd91a4 100644 --- a/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/RabbitMqStompDriverTest.php @@ -577,7 +577,7 @@ protected function getRouterTransportName(): string } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createManagementClientMock(): StompManagementClient { @@ -585,7 +585,7 @@ private function createManagementClientMock(): StompManagementClient } /** - * @return \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|LoggerInterface */ private function createLoggerMock() { diff --git a/pkg/enqueue/Tests/Client/Driver/StompManagementClientTest.php b/pkg/enqueue/Tests/Client/Driver/StompManagementClientTest.php index 325fe2c65..081a62c5f 100644 --- a/pkg/enqueue/Tests/Client/Driver/StompManagementClientTest.php +++ b/pkg/enqueue/Tests/Client/Driver/StompManagementClientTest.php @@ -81,7 +81,7 @@ public function testCouldCreateNewInstanceUsingFactory() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Client + * @return \PHPUnit\Framework\MockObject\MockObject|Client */ private function createClientMock() { @@ -89,7 +89,7 @@ private function createClientMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Exchange + * @return \PHPUnit\Framework\MockObject\MockObject|Exchange */ private function createExchangeMock() { @@ -97,7 +97,7 @@ private function createExchangeMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Queue + * @return \PHPUnit\Framework\MockObject\MockObject|Queue */ private function createQueueMock() { @@ -105,7 +105,7 @@ private function createQueueMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Binding + * @return \PHPUnit\Framework\MockObject\MockObject|Binding */ private function createBindingMock() { diff --git a/pkg/enqueue/Tests/Client/DriverPreSendTest.php b/pkg/enqueue/Tests/Client/DriverPreSendTest.php index d31ac17f1..85686b4c1 100644 --- a/pkg/enqueue/Tests/Client/DriverPreSendTest.php +++ b/pkg/enqueue/Tests/Client/DriverPreSendTest.php @@ -76,7 +76,7 @@ public function testShouldAllowGetTopic() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverMock(): DriverInterface { @@ -84,7 +84,7 @@ private function createDriverMock(): DriverInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createProducerMock(): ProducerInterface { diff --git a/pkg/enqueue/Tests/Client/PostSendTest.php b/pkg/enqueue/Tests/Client/PostSendTest.php index 76940732e..04927700c 100644 --- a/pkg/enqueue/Tests/Client/PostSendTest.php +++ b/pkg/enqueue/Tests/Client/PostSendTest.php @@ -90,7 +90,7 @@ public function testShouldAllowGetTopic() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverMock(): DriverInterface { @@ -98,7 +98,7 @@ private function createDriverMock(): DriverInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createProducerMock(): ProducerInterface { @@ -106,7 +106,7 @@ private function createProducerMock(): ProducerInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Destination + * @return \PHPUnit\Framework\MockObject\MockObject|Destination */ private function createDestinationMock(): Destination { @@ -114,7 +114,7 @@ private function createDestinationMock(): Destination } /** - * @return \PHPUnit_Framework_MockObject_MockObject|TransportMessage + * @return \PHPUnit\Framework\MockObject\MockObject|TransportMessage */ private function createTransportMessageMock(): TransportMessage { diff --git a/pkg/enqueue/Tests/Client/PreSendTest.php b/pkg/enqueue/Tests/Client/PreSendTest.php index d1e5595ba..408be1c69 100644 --- a/pkg/enqueue/Tests/Client/PreSendTest.php +++ b/pkg/enqueue/Tests/Client/PreSendTest.php @@ -109,7 +109,7 @@ public function testCouldChangeBody() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverMock(): DriverInterface { @@ -117,7 +117,7 @@ private function createDriverMock(): DriverInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createProducerMock(): ProducerInterface { diff --git a/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php b/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php index 3469c3862..8ac0704ca 100644 --- a/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php +++ b/pkg/enqueue/Tests/Client/ProducerSendCommandTest.php @@ -493,7 +493,7 @@ public function testShouldCallPostSendExtensionMethod() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createRpcFactoryMock(): RpcFactory { @@ -501,7 +501,7 @@ private function createRpcFactoryMock(): RpcFactory } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverStub(): DriverInterface { diff --git a/pkg/enqueue/Tests/Client/ProducerSendEventTest.php b/pkg/enqueue/Tests/Client/ProducerSendEventTest.php index 1346afe18..29a14b7d4 100644 --- a/pkg/enqueue/Tests/Client/ProducerSendEventTest.php +++ b/pkg/enqueue/Tests/Client/ProducerSendEventTest.php @@ -513,7 +513,7 @@ public function testShouldCallPostSendExtensionMethodWhenSendToApplicationRouter } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createRpcFactoryMock(): RpcFactory { @@ -521,7 +521,7 @@ private function createRpcFactoryMock(): RpcFactory } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverStub(): DriverInterface { diff --git a/pkg/enqueue/Tests/Client/ProducerTest.php b/pkg/enqueue/Tests/Client/ProducerTest.php index 4fbf4baea..558e70ee6 100644 --- a/pkg/enqueue/Tests/Client/ProducerTest.php +++ b/pkg/enqueue/Tests/Client/ProducerTest.php @@ -39,7 +39,7 @@ public function testCouldBeConstructedWithOptionalArguments() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createRpcFactoryMock(): RpcFactory { @@ -47,7 +47,7 @@ private function createRpcFactoryMock(): RpcFactory } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverMock(): DriverInterface { diff --git a/pkg/enqueue/Tests/Client/RouterProcessorTest.php b/pkg/enqueue/Tests/Client/RouterProcessorTest.php index d3f5039fa..cdd44df7a 100644 --- a/pkg/enqueue/Tests/Client/RouterProcessorTest.php +++ b/pkg/enqueue/Tests/Client/RouterProcessorTest.php @@ -195,7 +195,7 @@ public function testShouldDoNotModifyOriginalMessage() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverStub(RouteCollection $routeCollection = null): DriverInterface { diff --git a/pkg/enqueue/Tests/Client/SpoolProducerTest.php b/pkg/enqueue/Tests/Client/SpoolProducerTest.php index 8c00dedcd..024fd6da2 100644 --- a/pkg/enqueue/Tests/Client/SpoolProducerTest.php +++ b/pkg/enqueue/Tests/Client/SpoolProducerTest.php @@ -154,7 +154,7 @@ public function testShouldSendImmediatelyCommandMessageWithNeedReplyTrue() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ProducerInterface */ protected function createProducerMock() { diff --git a/pkg/enqueue/Tests/Client/TraceableProducerTest.php b/pkg/enqueue/Tests/Client/TraceableProducerTest.php index b25b7c18b..ff5ee83eb 100644 --- a/pkg/enqueue/Tests/Client/TraceableProducerTest.php +++ b/pkg/enqueue/Tests/Client/TraceableProducerTest.php @@ -366,7 +366,7 @@ public function testShouldAllowClearStoredTraces() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ProducerInterface */ protected function createProducerMock() { diff --git a/pkg/enqueue/Tests/Consumption/ChainExtensionTest.php b/pkg/enqueue/Tests/Consumption/ChainExtensionTest.php index c558424fe..23bd4f979 100644 --- a/pkg/enqueue/Tests/Consumption/ChainExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/ChainExtensionTest.php @@ -19,6 +19,7 @@ use Interop\Queue\Message; use Interop\Queue\Processor; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -275,7 +276,7 @@ public function testShouldProxyOnEndToAllInternalExtensions() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createLoggerMock(): LoggerInterface { @@ -283,7 +284,7 @@ protected function createLoggerMock(): LoggerInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropContextMock(): Context { @@ -291,7 +292,7 @@ protected function createInteropContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropConsumerMock(): Consumer { @@ -299,7 +300,7 @@ protected function createInteropConsumerMock(): Consumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropProcessorMock(): Processor { @@ -307,7 +308,7 @@ protected function createInteropProcessorMock(): Processor } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ExtensionInterface + * @return MockObject|ExtensionInterface */ protected function createExtension() { @@ -315,7 +316,7 @@ protected function createExtension() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createSubscriptionConsumerMock(): SubscriptionConsumer { diff --git a/pkg/enqueue/Tests/Consumption/Extension/LimitConsumedMessagesExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/LimitConsumedMessagesExtensionTest.php index 37d592e68..e1d4c50cd 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/LimitConsumedMessagesExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/LimitConsumedMessagesExtensionTest.php @@ -9,6 +9,7 @@ use Interop\Queue\Context; use Interop\Queue\Message; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -160,7 +161,7 @@ public function testOnPostReceivedShouldInterruptExecutionIfMessageLimitExceeded } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropContextMock(): Context { @@ -168,7 +169,7 @@ protected function createInteropContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createSubscriptionConsumerMock(): SubscriptionConsumer { @@ -176,7 +177,7 @@ private function createSubscriptionConsumerMock(): SubscriptionConsumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createLoggerMock(): LoggerInterface { diff --git a/pkg/enqueue/Tests/Consumption/Extension/LimitConsumerMemoryExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/LimitConsumerMemoryExtensionTest.php index de1531ea5..5a95486ec 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/LimitConsumerMemoryExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/LimitConsumerMemoryExtensionTest.php @@ -10,6 +10,7 @@ use Interop\Queue\Context; use Interop\Queue\Message; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -23,7 +24,8 @@ public function testCouldBeConstructedWithRequiredArguments() public function testShouldThrowExceptionIfMemoryLimitIsNotInt() { - $this->setExpectedException(\InvalidArgumentException::class, 'Expected memory limit is int but got: "double"'); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Expected memory limit is int but got: "double"'); new LimitConsumerMemoryExtension(0.0); } @@ -176,7 +178,7 @@ public function testOnPostMessageReceivedShouldNotInterruptExecutionIfMemoryLimi } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropContextMock(): Context { @@ -184,7 +186,7 @@ protected function createInteropContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createSubscriptionConsumerMock(): SubscriptionConsumer { @@ -192,7 +194,7 @@ private function createSubscriptionConsumerMock(): SubscriptionConsumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createLoggerMock(): LoggerInterface { diff --git a/pkg/enqueue/Tests/Consumption/Extension/LimitConsumptionTimeExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/LimitConsumptionTimeExtensionTest.php index 1eaef7874..fa730e384 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/LimitConsumptionTimeExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/LimitConsumptionTimeExtensionTest.php @@ -10,6 +10,7 @@ use Interop\Queue\Context; use Interop\Queue\Message; use Interop\Queue\SubscriptionConsumer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -154,7 +155,7 @@ public function testOnPostReceivedShouldNotInterruptExecutionIfConsumptionTimeIs } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropContextMock(): Context { @@ -162,7 +163,7 @@ protected function createInteropContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createSubscriptionConsumerMock(): SubscriptionConsumer { @@ -170,7 +171,7 @@ private function createSubscriptionConsumerMock(): SubscriptionConsumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createLoggerMock(): LoggerInterface { diff --git a/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php index 8038e5504..4bc4ae95f 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php @@ -20,6 +20,7 @@ use Interop\Queue\Context; use Interop\Queue\Processor; use Interop\Queue\Queue; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; @@ -230,7 +231,7 @@ public function testShouldLogMessageProcessedWithReasonResultObject() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createConsumerStub(Queue $queue): Consumer { @@ -245,7 +246,7 @@ private function createConsumerStub(Queue $queue): Consumer } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createContextMock(): Context { @@ -253,7 +254,7 @@ private function createContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createProcessorMock(): Processor { @@ -261,7 +262,7 @@ private function createProcessorMock(): Processor } /** - * @return \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @return MockObject|LoggerInterface */ private function createLogger() { diff --git a/pkg/enqueue/Tests/Consumption/Extension/LoggerExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/LoggerExtensionTest.php index 674720e23..f3641adf4 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/LoggerExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/LoggerExtensionTest.php @@ -6,6 +6,7 @@ use Enqueue\Consumption\Extension\LoggerExtension; use Enqueue\Consumption\InitLoggerExtensionInterface; use Enqueue\Test\ClassExtensionTrait; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -74,7 +75,7 @@ public function testShouldDoNothingIfSameLoggerInstanceAlreadySet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @return MockObject|LoggerInterface */ protected function createLogger() { diff --git a/pkg/enqueue/Tests/Consumption/Extension/NicenessExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/NicenessExtensionTest.php index 5b1834a88..a2937d0ca 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/NicenessExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/NicenessExtensionTest.php @@ -5,6 +5,7 @@ use Enqueue\Consumption\Context\Start; use Enqueue\Consumption\Extension\NicenessExtension; use Interop\Queue\Context as InteropContext; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -33,7 +34,7 @@ public function testShouldThrowWarningOnInvalidArgument() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropContext + * @return MockObject|InteropContext */ protected function createContextMock(): InteropContext { diff --git a/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php index 18e5727fd..408895638 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php @@ -12,6 +12,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Context; use Interop\Queue\Producer as InteropProducer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -103,7 +104,7 @@ public function testShouldSendReplyMessageToReplyQueueOnPostReceived() ->with($replyQueue, $replyMessage) ; - /** @var \PHPUnit_Framework_MockObject_MockObject|Context $contextMock */ + /** @var MockObject|Context $contextMock */ $contextMock = $this->createMock(Context::class); $contextMock ->expects($this->once()) @@ -129,7 +130,7 @@ public function testShouldSendReplyMessageToReplyQueueOnPostReceived() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ protected function createInteropContextMock(): Context { @@ -137,7 +138,7 @@ protected function createInteropContextMock(): Context } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createNeverUsedContextMock(): Context { diff --git a/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php b/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php index dce6081ef..62066737c 100644 --- a/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php +++ b/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php @@ -229,7 +229,7 @@ public function testShouldConsumeTillTimeoutIsReached() /** * @param mixed|null $body * - * @return InteropMessage|\PHPUnit_Framework_MockObject_MockObject + * @return InteropMessage|\PHPUnit\Framework\MockObject\MockObject */ private function createMessageStub($body = null) { @@ -246,7 +246,7 @@ private function createMessageStub($body = null) /** * @param mixed|null $queueName * - * @return Consumer|\PHPUnit_Framework_MockObject_MockObject + * @return Consumer|\PHPUnit\Framework\MockObject\MockObject */ private function createConsumerStub($queueName = null) { diff --git a/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php b/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php index b10339304..9e25ab931 100644 --- a/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php +++ b/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php @@ -1454,7 +1454,7 @@ public function testCaptureExitStatus() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createContextWithoutSubscriptionConsumerMock(): InteropContext { @@ -1469,7 +1469,7 @@ private function createContextWithoutSubscriptionConsumerMock(): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropContext + * @return \PHPUnit\Framework\MockObject\MockObject|InteropContext */ private function createContextStub(Consumer $consumer = null): InteropContext { @@ -1493,7 +1493,7 @@ private function createContextStub(Consumer $consumer = null): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Processor + * @return \PHPUnit\Framework\MockObject\MockObject|Processor */ private function createProcessorMock() { @@ -1501,7 +1501,7 @@ private function createProcessorMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Processor + * @return \PHPUnit\Framework\MockObject\MockObject|Processor */ private function createProcessorStub() { @@ -1516,7 +1516,7 @@ private function createProcessorStub() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Message + * @return \PHPUnit\Framework\MockObject\MockObject|Message */ private function createMessageMock(): Message { @@ -1524,7 +1524,7 @@ private function createMessageMock(): Message } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ExtensionInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ExtensionInterface */ private function createExtension() { @@ -1534,7 +1534,7 @@ private function createExtension() /** * @param mixed|null $queue * - * @return \PHPUnit_Framework_MockObject_MockObject|Consumer + * @return \PHPUnit\Framework\MockObject\MockObject|Consumer */ private function createConsumerStub($queue = null): Consumer { @@ -1553,7 +1553,7 @@ private function createConsumerStub($queue = null): Consumer } /** - * @return SubscriptionConsumer|\PHPUnit_Framework_MockObject_MockObject + * @return SubscriptionConsumer|\PHPUnit\Framework\MockObject\MockObject */ private function createSubscriptionConsumerMock(): SubscriptionConsumer { diff --git a/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php b/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php index 38e05806e..8a2e089f7 100644 --- a/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php +++ b/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php @@ -70,7 +70,7 @@ public function testShouldProduceRecipientsMessagesAndAckOriginalMessage() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropProducer + * @return \PHPUnit\Framework\MockObject\MockObject|InteropProducer */ protected function createProducerMock() { @@ -78,7 +78,7 @@ protected function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return \PHPUnit\Framework\MockObject\MockObject|Context */ protected function createContextMock() { @@ -86,7 +86,7 @@ protected function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|RecipientListRouterInterface + * @return \PHPUnit\Framework\MockObject\MockObject|RecipientListRouterInterface */ protected function createRecipientListRouterMock() { diff --git a/pkg/enqueue/Tests/Rpc/RpcClientTest.php b/pkg/enqueue/Tests/Rpc/RpcClientTest.php index 78f72bbe5..e2035c4d5 100644 --- a/pkg/enqueue/Tests/Rpc/RpcClientTest.php +++ b/pkg/enqueue/Tests/Rpc/RpcClientTest.php @@ -10,6 +10,7 @@ use Interop\Queue\Consumer; use Interop\Queue\Context; use Interop\Queue\Producer as InteropProducer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class RpcClientTest extends TestCase @@ -329,7 +330,7 @@ public function testShouldDoSyncCall() } /** - * @return Context|\PHPUnit_Framework_MockObject_MockObject|InteropProducer + * @return Context|MockObject|InteropProducer */ private function createInteropProducerMock() { @@ -337,7 +338,7 @@ private function createInteropProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Consumer + * @return MockObject|Consumer */ private function createConsumerMock() { @@ -345,7 +346,7 @@ private function createConsumerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return MockObject|Context */ private function createContextMock() { diff --git a/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php index 52bcd9a1e..be7de228e 100644 --- a/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php @@ -587,7 +587,7 @@ public function testShouldReturnExitStatusIfSet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DelegateProcessor + * @return \PHPUnit\Framework\MockObject\MockObject|DelegateProcessor */ private function createDelegateProcessorMock() { @@ -595,7 +595,7 @@ private function createDelegateProcessorMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|QueueConsumerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|QueueConsumerInterface */ private function createQueueConsumerMock() { @@ -603,7 +603,7 @@ private function createQueueConsumerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DriverInterface + * @return \PHPUnit\Framework\MockObject\MockObject|DriverInterface */ private function createDriverStub(RouteCollection $routeCollection = null): DriverInterface { @@ -624,7 +624,7 @@ private function createDriverStub(RouteCollection $routeCollection = null): Driv } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createContextWithoutSubscriptionConsumerMock(): InteropContext { @@ -639,7 +639,7 @@ private function createContextWithoutSubscriptionConsumerMock(): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropContext + * @return \PHPUnit\Framework\MockObject\MockObject|InteropContext */ private function createContextStub(Consumer $consumer = null): InteropContext { @@ -663,7 +663,7 @@ private function createContextStub(Consumer $consumer = null): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ExtensionInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ExtensionInterface */ private function createExtension() { @@ -673,7 +673,7 @@ private function createExtension() /** * @param mixed|null $queue * - * @return \PHPUnit_Framework_MockObject_MockObject|Consumer + * @return \PHPUnit\Framework\MockObject\MockObject|Consumer */ private function createConsumerStub($queue = null): Consumer { diff --git a/pkg/enqueue/Tests/Symfony/Client/FlushSpoolProducerListenerTest.php b/pkg/enqueue/Tests/Symfony/Client/FlushSpoolProducerListenerTest.php index a1fe06e7a..e7ca3ffd5 100644 --- a/pkg/enqueue/Tests/Symfony/Client/FlushSpoolProducerListenerTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/FlushSpoolProducerListenerTest.php @@ -58,7 +58,7 @@ public function testShouldFlushSpoolProducerOnFlushMessagesCall() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SpoolProducer + * @return \PHPUnit\Framework\MockObject\MockObject|SpoolProducer */ private function createSpoolProducerMock() { diff --git a/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php b/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php index aa0c8126a..c21750592 100644 --- a/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php +++ b/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php @@ -29,12 +29,14 @@ protected function configure() $this->configureSetupBrokerExtension(); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->extension = $this->getSetupBrokerExtension($input, new GenericDriver( new NullContext(), Config::create(), new RouteCollection([]) )); + + return 0; } } diff --git a/pkg/enqueue/Tests/Symfony/Client/ProduceCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/ProduceCommandTest.php index 7c50ae02c..0dffc3d42 100644 --- a/pkg/enqueue/Tests/Symfony/Client/ProduceCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/ProduceCommandTest.php @@ -268,7 +268,7 @@ public function testThrowIfClientNotFound() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ProducerInterface */ private function createProducerMock() { diff --git a/pkg/enqueue/Tests/Symfony/Client/RoutesCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/RoutesCommandTest.php index 0ed73ef1e..d9935bdf4 100644 --- a/pkg/enqueue/Tests/Symfony/Client/RoutesCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/RoutesCommandTest.php @@ -331,7 +331,7 @@ public function testShouldOutputRouteOptions() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverStub(Config $config, RouteCollection $routeCollection): DriverInterface { diff --git a/pkg/enqueue/Tests/Symfony/Client/SetupBrokerCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/SetupBrokerCommandTest.php index 4bbaf5534..358206dc7 100644 --- a/pkg/enqueue/Tests/Symfony/Client/SetupBrokerCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/SetupBrokerCommandTest.php @@ -130,7 +130,7 @@ public function testShouldThrowIfClientNotFound() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DriverInterface + * @return \PHPUnit\Framework\MockObject\MockObject|DriverInterface */ private function createClientDriverMock() { diff --git a/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php index cb12fe5aa..8f23acdbc 100644 --- a/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php @@ -104,7 +104,7 @@ public function testShouldBindDefaultQueueOnly() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DelegateProcessor + * @return \PHPUnit\Framework\MockObject\MockObject|DelegateProcessor */ private function createDelegateProcessorMock() { @@ -112,7 +112,7 @@ private function createDelegateProcessorMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|QueueConsumerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|QueueConsumerInterface */ private function createQueueConsumerMock() { @@ -120,7 +120,7 @@ private function createQueueConsumerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DriverInterface + * @return \PHPUnit\Framework\MockObject\MockObject|DriverInterface */ private function createDriverStub(RouteCollection $routeCollection = null): DriverInterface { diff --git a/pkg/enqueue/Tests/Symfony/Client/SimpleProduceCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/SimpleProduceCommandTest.php index 84391cd3e..71ac20f38 100644 --- a/pkg/enqueue/Tests/Symfony/Client/SimpleProduceCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/SimpleProduceCommandTest.php @@ -81,7 +81,7 @@ public function testThrowIfNeitherTopicNorCommandOptionsAreSet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ProducerInterface */ private function createProducerMock() { diff --git a/pkg/enqueue/Tests/Symfony/Client/SimpleRoutesCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/SimpleRoutesCommandTest.php index ce97be1c0..469334b02 100644 --- a/pkg/enqueue/Tests/Symfony/Client/SimpleRoutesCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/SimpleRoutesCommandTest.php @@ -83,7 +83,7 @@ public function testShouldOutputEmptyRouteCollection() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverMock(): DriverInterface { @@ -91,7 +91,7 @@ private function createDriverMock(): DriverInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createDriverStub(Config $config, RouteCollection $routeCollection): DriverInterface { diff --git a/pkg/enqueue/Tests/Symfony/Client/SimpleSetupBrokerCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/SimpleSetupBrokerCommandTest.php index 240cffa9a..0d30582e1 100644 --- a/pkg/enqueue/Tests/Symfony/Client/SimpleSetupBrokerCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/SimpleSetupBrokerCommandTest.php @@ -78,7 +78,7 @@ public function testShouldCallDriverSetupBrokerMethod() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|DriverInterface + * @return \PHPUnit\Framework\MockObject\MockObject|DriverInterface */ private function createClientDriverMock() { diff --git a/pkg/enqueue/Tests/Symfony/Consumption/ConfigurableConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Consumption/ConfigurableConsumeCommandTest.php index 4586849de..c788d5e75 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/ConfigurableConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/ConfigurableConsumeCommandTest.php @@ -274,7 +274,7 @@ public function testShouldExecuteConsumptionWithCustomTransportExplicitlySetQueu } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropQueue + * @return \PHPUnit\Framework\MockObject\MockObject|InteropQueue */ protected function createQueueMock() { @@ -282,7 +282,7 @@ protected function createQueueMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Processor + * @return \PHPUnit\Framework\MockObject\MockObject|Processor */ protected function createProcessor() { @@ -290,7 +290,7 @@ protected function createProcessor() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|QueueConsumerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|QueueConsumerInterface */ protected function createQueueConsumerMock() { diff --git a/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php index 88b826725..c2f2257c0 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php @@ -160,7 +160,7 @@ public function testShouldReturnExitStatusIfSet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|QueueConsumerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|QueueConsumerInterface */ private function createQueueConsumerMock() { @@ -168,7 +168,7 @@ private function createQueueConsumerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createContextWithoutSubscriptionConsumerMock(): InteropContext { @@ -183,7 +183,7 @@ private function createContextWithoutSubscriptionConsumerMock(): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|InteropContext + * @return \PHPUnit\Framework\MockObject\MockObject|InteropContext */ private function createContextStub(Consumer $consumer = null): InteropContext { @@ -207,7 +207,7 @@ private function createContextStub(Consumer $consumer = null): InteropContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ExtensionInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ExtensionInterface */ private function createExtension() { @@ -217,7 +217,7 @@ private function createExtension() /** * @param mixed|null $queue * - * @return \PHPUnit_Framework_MockObject_MockObject|Consumer + * @return \PHPUnit\Framework\MockObject\MockObject|Consumer */ private function createConsumerStub($queue = null): Consumer { diff --git a/pkg/enqueue/Tests/Symfony/Consumption/Mock/LimitsExtensionsCommand.php b/pkg/enqueue/Tests/Symfony/Consumption/Mock/LimitsExtensionsCommand.php index 7b6722393..05e0c56ba 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/Mock/LimitsExtensionsCommand.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/Mock/LimitsExtensionsCommand.php @@ -25,8 +25,10 @@ protected function configure() $this->configureLimitsExtensions(); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->extensions = $this->getLimitsExtensions($input, $output); + + return 0; } } diff --git a/pkg/enqueue/Tests/Symfony/Consumption/Mock/QueueConsumerOptionsCommand.php b/pkg/enqueue/Tests/Symfony/Consumption/Mock/QueueConsumerOptionsCommand.php index 289a5e711..147a3b905 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/Mock/QueueConsumerOptionsCommand.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/Mock/QueueConsumerOptionsCommand.php @@ -31,8 +31,10 @@ protected function configure() $this->configureQueueConsumerOptions(); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->setQueueConsumerOptions($this->consumer, $input); + + return 0; } } diff --git a/pkg/enqueue/Tests/Symfony/Consumption/QueueConsumerOptionsCommandTraitTest.php b/pkg/enqueue/Tests/Symfony/Consumption/QueueConsumerOptionsCommandTraitTest.php index c221f0284..b44c89af9 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/QueueConsumerOptionsCommandTraitTest.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/QueueConsumerOptionsCommandTraitTest.php @@ -37,7 +37,7 @@ public function testShouldSetQueueConsumerOptions() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|QueueConsumerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|QueueConsumerInterface */ private function createQueueConsumer() { diff --git a/pkg/enqueue/Tests/Symfony/Consumption/SimpleConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Consumption/SimpleConsumeCommandTest.php index 34d4161fb..19b9d76f8 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/SimpleConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/SimpleConsumeCommandTest.php @@ -77,7 +77,7 @@ public function testShouldExecuteDefaultConsumption() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|QueueConsumerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|QueueConsumerInterface */ private function createQueueConsumerMock() { diff --git a/pkg/enqueue/Tests/Symfony/ContainerProcessorRegistryTest.php b/pkg/enqueue/Tests/Symfony/ContainerProcessorRegistryTest.php index bb3cacb53..bf6e3cd01 100644 --- a/pkg/enqueue/Tests/Symfony/ContainerProcessorRegistryTest.php +++ b/pkg/enqueue/Tests/Symfony/ContainerProcessorRegistryTest.php @@ -91,7 +91,7 @@ public function testShouldThrowExceptionIfProcessorIsNotSet() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createProcessorMock(): Processor { @@ -99,7 +99,7 @@ private function createProcessorMock(): Processor } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return \PHPUnit\Framework\MockObject\MockObject */ private function createContainerMock(): ContainerInterface { diff --git a/pkg/enqueue/Tests/Symfony/LazyProducerTest.php b/pkg/enqueue/Tests/Symfony/LazyProducerTest.php index b574414c7..1b15ce2ce 100644 --- a/pkg/enqueue/Tests/Symfony/LazyProducerTest.php +++ b/pkg/enqueue/Tests/Symfony/LazyProducerTest.php @@ -116,7 +116,7 @@ public function testShouldProxyReturnedPromiseBackOnSendCommand() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ProducerInterface */ private function createProducerMock(): ProducerInterface { @@ -124,7 +124,7 @@ private function createProducerMock(): ProducerInterface } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ContainerInterface + * @return \PHPUnit\Framework\MockObject\MockObject|ContainerInterface */ private function createContainerMock(): ContainerInterface { diff --git a/pkg/enqueue/Tests/Util/JSONTest.php b/pkg/enqueue/Tests/Util/JSONTest.php index c37862eb0..a6f583387 100644 --- a/pkg/enqueue/Tests/Util/JSONTest.php +++ b/pkg/enqueue/Tests/Util/JSONTest.php @@ -16,7 +16,8 @@ public function testShouldDecodeString() public function testThrowIfMalformedJson() { - $this->setExpectedException(\InvalidArgumentException::class, 'The malformed json given. '); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('The malformed json given. '); $this->assertSame(['foo' => 'fooVal'], JSON::decode('{]')); } @@ -43,10 +44,8 @@ public function nonStringDataProvider() */ public function testShouldThrowExceptionIfInputIsNotString($value) { - $this->setExpectedException( - \InvalidArgumentException::class, - 'Accept only string argument but got:' - ); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Accept only string argument but got:'); $this->assertSame(0, JSON::decode($value)); } @@ -96,10 +95,8 @@ public function testShouldEncodeObjectOfJsonSerializableClass() public function testThrowIfValueIsResource() { - $this->setExpectedException( - \InvalidArgumentException::class, - 'Could not encode value into json. Error 8 and message Type is not supported' - ); + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Could not encode value into json. Error 8 and message Type is not supported'); $resource = fopen('php://memory', 'r'); fclose($resource); diff --git a/pkg/enqueue/composer.json b/pkg/enqueue/composer.json index 29cd7a847..84a41b05d 100644 --- a/pkg/enqueue/composer.json +++ b/pkg/enqueue/composer.json @@ -16,12 +16,13 @@ "psr/container": "^1" }, "require-dev": { - "phpunit/phpunit": "~5.5", - "symfony/console": "^3.4|^4", - "symfony/dependency-injection": "^3.4|^4", - "symfony/config": "^3.4|^4", - "symfony/event-dispatcher": "^3.4|^4", - "symfony/http-kernel": "^3.4|^4", + "phpunit/phpunit": "~7.5", + "symfony/console": "^4.3|^5", + "symfony/dependency-injection": "^4.3|^5", + "symfony/config": "^4.3|^5", + "symfony/event-dispatcher": "^4.3|^5", + "symfony/http-kernel": "^4.3|^5", + "symfony/yaml": "^4.3|^5", "enqueue/amqp-ext": "0.9.x-dev", "enqueue/amqp-lib": "0.9.x-dev", "enqueue/amqp-bunny": "0.9.x-dev", @@ -41,9 +42,9 @@ "enqueue/dsn": "0.9.x-dev" }, "suggest": { - "symfony/console": "^2.8|^3|^4 If you want to use cli commands", - "symfony/dependency-injection": "^3.4|^4", - "symfony/config": "^3.4|^4", + "symfony/console": "^2.8|^3|^4|^5 If you want to use cli commands", + "symfony/dependency-injection": "^4.3|^5", + "symfony/config": "^4.3|^5", "enqueue/amqp-ext": "AMQP transport (based on php extension)", "enqueue/stomp": "STOMP transport", "enqueue/fs": "Filesystem transport", diff --git a/pkg/enqueue/phpunit.xml.dist b/pkg/enqueue/phpunit.xml.dist index 156ab4929..2b99dda0b 100644 --- a/pkg/enqueue/phpunit.xml.dist +++ b/pkg/enqueue/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/fs/Tests/FsConsumerTest.php b/pkg/fs/Tests/FsConsumerTest.php index 90048b2d0..086bb55fe 100644 --- a/pkg/fs/Tests/FsConsumerTest.php +++ b/pkg/fs/Tests/FsConsumerTest.php @@ -134,7 +134,7 @@ public function testShouldWaitTwoSecondsForMessageAndExitOnReceive() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|FsProducer + * @return \PHPUnit\Framework\MockObject\MockObject|FsProducer */ private function createProducerMock() { @@ -142,7 +142,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|FsContext + * @return \PHPUnit\Framework\MockObject\MockObject|FsContext */ private function createContextMock() { diff --git a/pkg/fs/Tests/FsProducerTest.php b/pkg/fs/Tests/FsProducerTest.php index 3311287a5..28700d52f 100644 --- a/pkg/fs/Tests/FsProducerTest.php +++ b/pkg/fs/Tests/FsProducerTest.php @@ -63,7 +63,7 @@ public function testShouldCallContextWorkWithFileAndCallbackToItOnSend() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|FsContext + * @return \PHPUnit\Framework\MockObject\MockObject|FsContext */ private function createContextMock() { diff --git a/pkg/fs/Tests/Functional/FsCommonUseCasesTest.php b/pkg/fs/Tests/Functional/FsCommonUseCasesTest.php index 6ad6f5569..1ae462731 100644 --- a/pkg/fs/Tests/Functional/FsCommonUseCasesTest.php +++ b/pkg/fs/Tests/Functional/FsCommonUseCasesTest.php @@ -24,7 +24,7 @@ public function setUp() new TempFile(sys_get_temp_dir().'/fs_test_queue'); } - public function tearDown() + public function tearDown(): void { $this->fsContext->close(); } diff --git a/pkg/fs/Tests/Functional/FsConsumerTest.php b/pkg/fs/Tests/Functional/FsConsumerTest.php index 50cab8533..9dd7a0103 100644 --- a/pkg/fs/Tests/Functional/FsConsumerTest.php +++ b/pkg/fs/Tests/Functional/FsConsumerTest.php @@ -22,7 +22,7 @@ public function setUp() $this->fsContext->purgeQueue($this->fsContext->createQueue('fs_test_queue')); } - public function tearDown() + public function tearDown(): void { $this->fsContext->close(); } diff --git a/pkg/fs/Tests/Functional/FsConsumptionUseCasesTest.php b/pkg/fs/Tests/Functional/FsConsumptionUseCasesTest.php index 7ea11c74c..98895a62d 100644 --- a/pkg/fs/Tests/Functional/FsConsumptionUseCasesTest.php +++ b/pkg/fs/Tests/Functional/FsConsumptionUseCasesTest.php @@ -32,7 +32,7 @@ public function setUp() new TempFile(sys_get_temp_dir().'/fs_test_queue'); } - public function tearDown() + public function tearDown(): void { $this->fsContext->close(); } diff --git a/pkg/fs/Tests/Functional/FsContextTest.php b/pkg/fs/Tests/Functional/FsContextTest.php index bdcfb341a..287fd6c04 100644 --- a/pkg/fs/Tests/Functional/FsContextTest.php +++ b/pkg/fs/Tests/Functional/FsContextTest.php @@ -14,7 +14,7 @@ class FsContextTest extends TestCase */ private $fsContext; - public function tearDown() + public function tearDown(): void { $fs = new Filesystem(); $fs->remove(sys_get_temp_dir().'/enqueue'); diff --git a/pkg/fs/Tests/Functional/FsProducerTest.php b/pkg/fs/Tests/Functional/FsProducerTest.php index 634e09882..6f7e4b4fa 100644 --- a/pkg/fs/Tests/Functional/FsProducerTest.php +++ b/pkg/fs/Tests/Functional/FsProducerTest.php @@ -22,7 +22,7 @@ public function setUp() file_put_contents(sys_get_temp_dir().'/fs_test_queue', ''); } - public function tearDown() + public function tearDown(): void { $this->fsContext->close(); } diff --git a/pkg/fs/Tests/Functional/FsRpcUseCasesTest.php b/pkg/fs/Tests/Functional/FsRpcUseCasesTest.php index 91c40f450..046a25f9c 100644 --- a/pkg/fs/Tests/Functional/FsRpcUseCasesTest.php +++ b/pkg/fs/Tests/Functional/FsRpcUseCasesTest.php @@ -28,7 +28,7 @@ public function setUp() new TempFile(sys_get_temp_dir().'/fs_reply_queue'); } - public function tearDown() + public function tearDown(): void { $this->fsContext->close(); } diff --git a/pkg/fs/composer.json b/pkg/fs/composer.json index fb95a36f9..39f40ef19 100644 --- a/pkg/fs/composer.json +++ b/pkg/fs/composer.json @@ -9,15 +9,16 @@ "php": "^7.1.3", "queue-interop/queue-interop": "^0.7|^0.8", "enqueue/dsn": "^0.9", - "symfony/filesystem": "^3.4|^4", + "symfony/filesystem": "^4.3|^5", "makasim/temp-file": "^0.2@stable" }, "require-dev": { - "phpunit/phpunit": "~5.5", + "phpunit/phpunit": "~7.5", "enqueue/null": "0.9.x-dev", "enqueue/test": "0.9.x-dev", "queue-interop/queue-spec": "^0.6", - "symfony/dependency-injection": "^3.4|^4" + "symfony/dependency-injection": "^4.3|^5", + "symfony/yaml": "^4.3|^5" }, "support": { "email": "opensource@forma-pro.com", diff --git a/pkg/fs/phpunit.xml.dist b/pkg/fs/phpunit.xml.dist index 9754bd41f..ccc9b044b 100644 --- a/pkg/fs/phpunit.xml.dist +++ b/pkg/fs/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/gearman/Tests/GearmanProducerTest.php b/pkg/gearman/Tests/GearmanProducerTest.php index 907d9ef46..afb6181a3 100644 --- a/pkg/gearman/Tests/GearmanProducerTest.php +++ b/pkg/gearman/Tests/GearmanProducerTest.php @@ -10,6 +10,7 @@ use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Exception\InvalidDestinationException; use Interop\Queue\Exception\InvalidMessageException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class GearmanProducerTest extends TestCase @@ -68,7 +69,7 @@ public function testShouldJsonEncodeMessageAndPutToExpectedTube() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\GearmanClient + * @return MockObject|\GearmanClient */ private function createGearmanClientMock() { diff --git a/pkg/gearman/phpunit.xml.dist b/pkg/gearman/phpunit.xml.dist index 626570c00..26f1d81f1 100644 --- a/pkg/gearman/phpunit.xml.dist +++ b/pkg/gearman/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/gps/Tests/GpsConsumerTest.php b/pkg/gps/Tests/GpsConsumerTest.php index 24bed7e3b..0b4b925ce 100644 --- a/pkg/gps/Tests/GpsConsumerTest.php +++ b/pkg/gps/Tests/GpsConsumerTest.php @@ -180,7 +180,7 @@ public function testShouldReceiveMessage() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|GpsContext + * @return \PHPUnit\Framework\MockObject\MockObject|GpsContext */ private function createContextMock() { @@ -188,7 +188,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|PubSubClient + * @return \PHPUnit\Framework\MockObject\MockObject|PubSubClient */ private function createPubSubClientMock() { @@ -196,7 +196,7 @@ private function createPubSubClientMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Subscription + * @return \PHPUnit\Framework\MockObject\MockObject|Subscription */ private function createSubscriptionMock() { diff --git a/pkg/gps/Tests/GpsContextTest.php b/pkg/gps/Tests/GpsContextTest.php index 355eeff81..658e2659e 100644 --- a/pkg/gps/Tests/GpsContextTest.php +++ b/pkg/gps/Tests/GpsContextTest.php @@ -87,7 +87,7 @@ public function testCreateConsumerShouldThrowExceptionIfInvalidDestination() } /** - * @return PubSubClient|\PHPUnit_Framework_MockObject_MockObject|PubSubClient + * @return PubSubClient|\PHPUnit\Framework\MockObject\MockObject|PubSubClient */ private function createPubSubClientMock() { diff --git a/pkg/gps/Tests/GpsProducerTest.php b/pkg/gps/Tests/GpsProducerTest.php index 6d3191bb8..1e1bfae41 100644 --- a/pkg/gps/Tests/GpsProducerTest.php +++ b/pkg/gps/Tests/GpsProducerTest.php @@ -56,7 +56,7 @@ public function testShouldSendMessage() } /** - * @return GpsContext|\PHPUnit_Framework_MockObject_MockObject|GpsContext + * @return GpsContext|\PHPUnit\Framework\MockObject\MockObject|GpsContext */ private function createContextMock() { @@ -64,7 +64,7 @@ private function createContextMock() } /** - * @return PubSubClient|\PHPUnit_Framework_MockObject_MockObject|PubSubClient + * @return PubSubClient|\PHPUnit\Framework\MockObject\MockObject|PubSubClient */ private function createPubSubClientMock() { @@ -72,7 +72,7 @@ private function createPubSubClientMock() } /** - * @return Topic|\PHPUnit_Framework_MockObject_MockObject|Topic + * @return Topic|\PHPUnit\Framework\MockObject\MockObject|Topic */ private function createGTopicMock() { diff --git a/pkg/gps/phpunit.xml.dist b/pkg/gps/phpunit.xml.dist index 57e46d2f2..af7972bc6 100644 --- a/pkg/gps/phpunit.xml.dist +++ b/pkg/gps/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php b/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php index ff5e97c48..2e5a6ac4c 100644 --- a/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php +++ b/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php @@ -12,6 +12,7 @@ use Enqueue\JobQueue\Topics; use Enqueue\Null\NullMessage; use Interop\Queue\Context; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class CalculateRootJobStatusProcessorTest extends \PHPUnit\Framework\TestCase @@ -176,7 +177,7 @@ public function testShouldSendRootJobStoppedMessageIfJobHasStopped() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return MockObject|ProducerInterface */ private function createProducerMock() { @@ -184,7 +185,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return MockObject|Context */ private function createContextMock() { @@ -192,7 +193,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @return MockObject|LoggerInterface */ private function createLoggerMock() { @@ -200,7 +201,7 @@ private function createLoggerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|CalculateRootJobStatusService + * @return MockObject|CalculateRootJobStatusService */ private function createCalculateRootJobStatusCaseMock() { @@ -208,7 +209,7 @@ private function createCalculateRootJobStatusCaseMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|JobStorage + * @return MockObject|JobStorage */ private function createJobStorageMock() { diff --git a/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php b/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php index bf16d81ff..bcb62531a 100644 --- a/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php +++ b/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php @@ -5,6 +5,7 @@ use Enqueue\JobQueue\CalculateRootJobStatusService; use Enqueue\JobQueue\Doctrine\JobStorage; use Enqueue\JobQueue\Job; +use PHPUnit\Framework\MockObject\MockObject; class CalculateRootJobStatusServiceTest extends \PHPUnit\Framework\TestCase { @@ -153,10 +154,8 @@ public function testShouldThrowIfInvalidStatus() $case = new CalculateRootJobStatusService($storage); - $this->setExpectedException( - \LogicException::class, - 'Got unsupported job status: id: "12345" status: "invalid-status"' - ); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Got unsupported job status: id: "12345" status: "invalid-status"'); $case->calculate($childJob); } @@ -356,7 +355,7 @@ public function testShouldSetStatusSuccessIfAllAreSuccess() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\Enqueue\JobQueue\Doctrine\JobStorage + * @return MockObject|\Enqueue\JobQueue\Doctrine\JobStorage */ private function createJobStorageMock() { diff --git a/pkg/job-queue/Tests/DependentJobProcessorTest.php b/pkg/job-queue/Tests/DependentJobProcessorTest.php index fe0980714..fff9517a4 100644 --- a/pkg/job-queue/Tests/DependentJobProcessorTest.php +++ b/pkg/job-queue/Tests/DependentJobProcessorTest.php @@ -11,6 +11,7 @@ use Enqueue\JobQueue\Topics; use Enqueue\Null\NullMessage; use Interop\Queue\Context; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class DependentJobProcessorTest extends \PHPUnit\Framework\TestCase @@ -317,7 +318,7 @@ public function testShouldPublishDependentMessageWithPriority() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Context + * @return MockObject|Context */ private function createContextMock() { @@ -325,7 +326,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\Enqueue\JobQueue\Doctrine\JobStorage + * @return MockObject|\Enqueue\JobQueue\Doctrine\JobStorage */ private function createJobStorageMock() { @@ -333,7 +334,7 @@ private function createJobStorageMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerInterface + * @return MockObject|ProducerInterface */ private function createProducerMock() { @@ -341,7 +342,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|LoggerInterface + * @return MockObject|LoggerInterface */ private function createLoggerMock() { diff --git a/pkg/job-queue/Tests/DependentJobServiceTest.php b/pkg/job-queue/Tests/DependentJobServiceTest.php index ed0f79519..149856308 100644 --- a/pkg/job-queue/Tests/DependentJobServiceTest.php +++ b/pkg/job-queue/Tests/DependentJobServiceTest.php @@ -6,6 +6,7 @@ use Enqueue\JobQueue\DependentJobService; use Enqueue\JobQueue\Doctrine\JobStorage; use Enqueue\JobQueue\Job; +use PHPUnit\Framework\MockObject\MockObject; class DependentJobServiceTest extends \PHPUnit\Framework\TestCase { @@ -24,7 +25,8 @@ public function testShouldThrowIfJobIsNotRootJob() $service = new DependentJobService($this->createJobStorageMock()); - $this->setExpectedException(\LogicException::class, 'Only root jobs allowed but got child. jobId: "12345"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Only root jobs allowed but got child. jobId: "12345"'); $service->saveDependentJob($context); } @@ -66,7 +68,7 @@ public function testShouldSaveDependentJobs() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\Enqueue\JobQueue\Doctrine\JobStorage + * @return MockObject|\Enqueue\JobQueue\Doctrine\JobStorage */ private function createJobStorageMock() { diff --git a/pkg/job-queue/Tests/Doctrine/JobStorageTest.php b/pkg/job-queue/Tests/Doctrine/JobStorageTest.php index 8344fd0b6..622a79819 100644 --- a/pkg/job-queue/Tests/Doctrine/JobStorageTest.php +++ b/pkg/job-queue/Tests/Doctrine/JobStorageTest.php @@ -11,6 +11,7 @@ use Enqueue\JobQueue\Doctrine\JobStorage; use Enqueue\JobQueue\DuplicateJobException; use Enqueue\JobQueue\Job; +use PHPUnit\Framework\MockObject\MockObject; class JobStorageTest extends \PHPUnit\Framework\TestCase { @@ -136,11 +137,8 @@ public function testShouldThrowIfGotUnexpectedJobInstance() $storage = new JobStorage($doctrine, 'entity-class', 'unique_table'); - $this->setExpectedException( - \LogicException::class, - 'Got unexpected job instance: expected: "expected\class\name", '. - 'actual" "Enqueue\JobQueue\Job"' - ); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Got unexpected job instance: expected: "expected\class\name", actual" "Enqueue\JobQueue\Job"'); $storage->saveJob(new Job()); } @@ -316,7 +314,8 @@ public function testShouldCatchUniqueConstraintViolationExceptionAndThrowDuplica $storage = new JobStorage($doctrine, 'entity-class', 'unique_table'); - $this->setExpectedException(DuplicateJobException::class, 'Duplicate job. ownerId:"owner-id", name:"job-name"'); + $this->expectException(DuplicateJobException::class); + $this->expectExceptionMessage('Duplicate job. ownerId:"owner-id", name:"job-name"'); $storage->saveJob($job); } @@ -359,11 +358,8 @@ public function testShouldThrowIfTryToSaveNewEntityWithLock() $storage = new JobStorage($doctrine, 'entity-class', 'unique_table'); - $this->setExpectedException( - \LogicException::class, - 'Is not possible to create new job with lock, only update is allowed' - ); - + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Is not possible to create new job with lock, only update is allowed'); $storage->saveJob($job, function () { }); } @@ -579,7 +575,7 @@ public function testShouldDeleteRecordFromUniqueTableIfJobIsUniqueAndStoppedAtIs } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry + * @return MockObject|ManagerRegistry */ private function createDoctrineMock() { @@ -587,7 +583,7 @@ private function createDoctrineMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Connection + * @return MockObject|Connection */ private function createConnectionMock() { @@ -595,7 +591,7 @@ private function createConnectionMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|EntityManager + * @return MockObject|EntityManager */ private function createEntityManagerMock() { @@ -603,7 +599,7 @@ private function createEntityManagerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|EntityRepository + * @return MockObject|EntityRepository */ private function createRepositoryMock() { @@ -611,7 +607,7 @@ private function createRepositoryMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|UniqueConstraintViolationException + * @return MockObject|UniqueConstraintViolationException */ private function createUniqueConstraintViolationExceptionMock() { diff --git a/pkg/job-queue/Tests/Functional/Job/JobStorageTest.php b/pkg/job-queue/Tests/Functional/Job/JobStorageTest.php index 4cc05f8e0..c2c8fb94d 100644 --- a/pkg/job-queue/Tests/Functional/Job/JobStorageTest.php +++ b/pkg/job-queue/Tests/Functional/Job/JobStorageTest.php @@ -128,7 +128,7 @@ public function testShouldThrowIfDuplicateJob() $job2->setStatus(Job::STATUS_NEW); $job2->setCreatedAt(new \DateTime()); - $this->setExpectedException(DuplicateJobException::class); + $this->expectException(DuplicateJobException::class); $this->getJobStorage()->saveJob($job2); } diff --git a/pkg/job-queue/Tests/Functional/WebTestCase.php b/pkg/job-queue/Tests/Functional/WebTestCase.php index ecb6e5af9..2f8e17cea 100644 --- a/pkg/job-queue/Tests/Functional/WebTestCase.php +++ b/pkg/job-queue/Tests/Functional/WebTestCase.php @@ -33,11 +33,11 @@ protected function setUp() $this->startTransaction(); } - protected function tearDown() + protected function tearDown(): void { $this->rollbackTransaction(); - parent::tearDown(); + static::ensureKernelShutdown(); } /** diff --git a/pkg/job-queue/Tests/Functional/app/config/config.yml b/pkg/job-queue/Tests/Functional/app/config/config.yml index 2297c7bb4..b6d642b82 100644 --- a/pkg/job-queue/Tests/Functional/app/config/config.yml +++ b/pkg/job-queue/Tests/Functional/app/config/config.yml @@ -7,11 +7,10 @@ framework: #translator: { fallback: "%locale%" } test: ~ assets: false - templating: false session: storage_id: session.storage.mock_file secret: "%secret%" - router: { resource: "%kernel.root_dir%/config/routing.yml" } + router: { resource: "%kernel.project_dir%/config/routing.yml" } default_locale: "%locale%" doctrine: @@ -27,7 +26,7 @@ doctrine: TestEntity: mapping: true type: annotation - dir: '%kernel.root_dir%/../Entity' + dir: '%kernel.project_dir%/Tests/Functional/Entity' alias: 'EnqueueJobQueue' prefix: 'Enqueue\JobQueue\Tests\Functional\Entity' is_bundle: false diff --git a/pkg/job-queue/Tests/JobProcessorTest.php b/pkg/job-queue/Tests/JobProcessorTest.php index b91a23a97..f4e937c02 100644 --- a/pkg/job-queue/Tests/JobProcessorTest.php +++ b/pkg/job-queue/Tests/JobProcessorTest.php @@ -8,6 +8,7 @@ use Enqueue\JobQueue\DuplicateJobException; use Enqueue\JobQueue\Job; use Enqueue\JobQueue\JobProcessor; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class JobProcessorTest extends TestCase @@ -21,7 +22,8 @@ public function testCreateRootJobShouldThrowIfOwnerIdIsEmpty() { $processor = new JobProcessor($this->createJobStorage(), $this->createProducerMock()); - $this->setExpectedException(\LogicException::class, 'OwnerId must not be empty'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('OwnerId must not be empty'); $processor->findOrCreateRootJob(null, 'job-name', true); } @@ -30,7 +32,8 @@ public function testCreateRootJobShouldThrowIfNameIsEmpty() { $processor = new JobProcessor($this->createJobStorage(), $this->createProducerMock()); - $this->setExpectedException(\LogicException::class, 'Job name must not be empty'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Job name must not be empty'); $processor->findOrCreateRootJob('owner-id', null, true); } @@ -98,7 +101,8 @@ public function testCreateChildJobShouldThrowIfNameIsEmpty() { $processor = new JobProcessor($this->createJobStorage(), $this->createProducerMock()); - $this->setExpectedException(\LogicException::class, 'Job name must not be empty'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Job name must not be empty'); $processor->findOrCreateChildJob(null, new Job()); } @@ -193,7 +197,8 @@ public function testStartChildJobShouldThrowIfRootJob() $rootJob = new Job(); $rootJob->setId(12345); - $this->setExpectedException(\LogicException::class, 'Can\'t start root jobs. id: "12345"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can\'t start root jobs. id: "12345"'); $processor->startChildJob($rootJob); } @@ -215,10 +220,8 @@ public function testStartChildJobShouldThrowIfJobHasNotNewStatus() $processor = new JobProcessor($storage, $this->createProducerMock()); - $this->setExpectedException( - \LogicException::class, - 'Can start only new jobs: id: "12345", status: "enqueue.job_queue.status.cancelled"' - ); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can start only new jobs: id: "12345", status: "enqueue.job_queue.status.cancelled"'); $processor->startChildJob($job); } @@ -263,7 +266,8 @@ public function testSuccessChildJobShouldThrowIfRootJob() $rootJob = new Job(); $rootJob->setId(12345); - $this->setExpectedException(\LogicException::class, 'Can\'t success root jobs. id: "12345"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can\'t success root jobs. id: "12345"'); $processor->successChildJob($rootJob); } @@ -285,10 +289,8 @@ public function testSuccessChildJobShouldThrowIfJobHasNotRunningStatus() $processor = new JobProcessor($storage, $this->createProducerMock()); - $this->setExpectedException( - \LogicException::class, - 'Can success only running jobs. id: "12345", status: "enqueue.job_queue.status.cancelled"' - ); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can success only running jobs. id: "12345", status: "enqueue.job_queue.status.cancelled"'); $processor->successChildJob($job); } @@ -333,7 +335,8 @@ public function testFailChildJobShouldThrowIfRootJob() $rootJob = new Job(); $rootJob->setId(12345); - $this->setExpectedException(\LogicException::class, 'Can\'t fail root jobs. id: "12345"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can\'t fail root jobs. id: "12345"'); $processor->failChildJob($rootJob); } @@ -355,10 +358,8 @@ public function testFailChildJobShouldThrowIfJobHasNotRunningStatus() $processor = new JobProcessor($storage, $this->createProducerMock()); - $this->setExpectedException( - \LogicException::class, - 'Can fail only running jobs. id: "12345", status: "enqueue.job_queue.status.cancelled"' - ); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can fail only running jobs. id: "12345", status: "enqueue.job_queue.status.cancelled"'); $processor->failChildJob($job); } @@ -403,7 +404,8 @@ public function testCancelChildJobShouldThrowIfRootJob() $rootJob = new Job(); $rootJob->setId(12345); - $this->setExpectedException(\LogicException::class, 'Can\'t cancel root jobs. id: "12345"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can\'t cancel root jobs. id: "12345"'); $processor->cancelChildJob($rootJob); } @@ -425,10 +427,8 @@ public function testCancelChildJobShouldThrowIfJobHasNotNewOrRunningStatus() $processor = new JobProcessor($storage, $this->createProducerMock()); - $this->setExpectedException( - \LogicException::class, - 'Can cancel only new or running jobs. id: "12345", status: "enqueue.job_queue.status.cancelled"' - ); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can cancel only new or running jobs. id: "12345", status: "enqueue.job_queue.status.cancelled"'); $processor->cancelChildJob($job); } @@ -475,7 +475,8 @@ public function testInterruptRootJobShouldThrowIfNotRootJob() $processor = new JobProcessor($this->createJobStorage(), $this->createProducerMock()); - $this->setExpectedException(\LogicException::class, 'Can interrupt only root jobs. id: "123"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Can interrupt only root jobs. id: "123"'); $processor->interruptRootJob($notRootJob); } @@ -539,7 +540,7 @@ public function testInterruptRootJobShouldUpdateJobAndSetInterruptedTrueAndStopp } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createJobStorage(): JobStorage { @@ -547,7 +548,7 @@ private function createJobStorage(): JobStorage } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function createProducerMock(): ProducerInterface { diff --git a/pkg/job-queue/Tests/JobRunnerTest.php b/pkg/job-queue/Tests/JobRunnerTest.php index aa7a7f49e..e43440fe3 100644 --- a/pkg/job-queue/Tests/JobRunnerTest.php +++ b/pkg/job-queue/Tests/JobRunnerTest.php @@ -6,6 +6,7 @@ use Enqueue\JobQueue\JobProcessor; use Enqueue\JobQueue\JobRunner; use Enqueue\JobQueue\OrphanJobException; +use PHPUnit\Framework\MockObject\MockObject; class JobRunnerTest extends \PHPUnit\Framework\TestCase { @@ -301,7 +302,8 @@ public function testRunDelayedShouldThrowExceptionIfJobWasNotFoundById() $jobRunner = new JobRunner($jobProcessor); - $this->setExpectedException(\LogicException::class, 'Job was not found. id: "job-id"'); + $this->expectException(\LogicException::class); + $this->expectExceptionMessage('Job was not found. id: "job-id"'); $jobRunner->runDelayed('job-id', function () { }); @@ -450,7 +452,7 @@ public function testRunDelayedShouldNotSuccessJobIfAlreadyStopped() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|JobProcessor + * @return MockObject|JobProcessor */ private function createJobProcessorMock() { diff --git a/pkg/job-queue/composer.json b/pkg/job-queue/composer.json index 4581d6cee..653689793 100644 --- a/pkg/job-queue/composer.json +++ b/pkg/job-queue/composer.json @@ -13,12 +13,13 @@ "doctrine/orm": "~2.4" }, "require-dev": { - "phpunit/phpunit": "~5.5", + "phpunit/phpunit": "~7.5", "enqueue/test": "0.9.x-dev", - "doctrine/doctrine-bundle": "~1.2", - "symfony/browser-kit": "^3.4|^4", - "symfony/expression-language": "^3.4|^4", - "symfony/framework-bundle": "^3.4|^4" + "doctrine/doctrine-bundle": "~1.2|^2", + "symfony/browser-kit": "^4.3|^5", + "symfony/expression-language": "^4.3|^5", + "symfony/framework-bundle": "^4.3|^5", + "symfony/yaml": "^4.3|^5" }, "support": { "email": "opensource@forma-pro.com", diff --git a/pkg/job-queue/phpunit.xml.dist b/pkg/job-queue/phpunit.xml.dist index 29dc33404..d82f4457f 100644 --- a/pkg/job-queue/phpunit.xml.dist +++ b/pkg/job-queue/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/mongodb/Tests/Functional/MongodbConsumerTest.php b/pkg/mongodb/Tests/Functional/MongodbConsumerTest.php index 609a22e16..6e7f01e5c 100644 --- a/pkg/mongodb/Tests/Functional/MongodbConsumerTest.php +++ b/pkg/mongodb/Tests/Functional/MongodbConsumerTest.php @@ -24,7 +24,7 @@ public function setUp() $this->context = $this->buildMongodbContext(); } - protected function tearDown() + protected function tearDown(): void { if ($this->context) { $this->context->close(); diff --git a/pkg/mongodb/Tests/MongodbConsumerTest.php b/pkg/mongodb/Tests/MongodbConsumerTest.php index b1b98e0cd..cd2ee06f8 100644 --- a/pkg/mongodb/Tests/MongodbConsumerTest.php +++ b/pkg/mongodb/Tests/MongodbConsumerTest.php @@ -113,7 +113,7 @@ public function testRejectShouldReSendMessageToSameQueueOnRequeue() } /** - * @return MongodbProducer|\PHPUnit_Framework_MockObject_MockObject + * @return MongodbProducer|\PHPUnit\Framework\MockObject\MockObject */ private function createProducerMock() { @@ -121,7 +121,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|MongodbContext + * @return \PHPUnit\Framework\MockObject\MockObject|MongodbContext */ private function createContextMock() { @@ -133,6 +133,7 @@ class InvalidMessage implements Message { public function getBody(): string { + throw new \BadMethodCallException('This should not be called directly'); } public function setBody(string $body): void @@ -145,6 +146,7 @@ public function setProperties(array $properties): void public function getProperties(): array { + throw new \BadMethodCallException('This should not be called directly'); } public function setProperty(string $name, $value): void @@ -161,6 +163,7 @@ public function setHeaders(array $headers): void public function getHeaders(): array { + throw new \BadMethodCallException('This should not be called directly'); } public function setHeader(string $name, $value): void @@ -177,6 +180,7 @@ public function setRedelivered(bool $redelivered): void public function isRedelivered(): bool { + throw new \BadMethodCallException('This should not be called directly'); } public function setCorrelationId(string $correlationId = null): void @@ -185,6 +189,7 @@ public function setCorrelationId(string $correlationId = null): void public function getCorrelationId(): ?string { + throw new \BadMethodCallException('This should not be called directly'); } public function setMessageId(string $messageId = null): void @@ -193,10 +198,12 @@ public function setMessageId(string $messageId = null): void public function getMessageId(): ?string { + throw new \BadMethodCallException('This should not be called directly'); } public function getTimestamp(): ?int { + throw new \BadMethodCallException('This should not be called directly'); } public function setTimestamp(int $timestamp = null): void @@ -209,5 +216,6 @@ public function setReplyTo(string $replyTo = null): void public function getReplyTo(): ?string { + throw new \BadMethodCallException('This should not be called directly'); } } diff --git a/pkg/mongodb/Tests/MongodbContextTest.php b/pkg/mongodb/Tests/MongodbContextTest.php index d43f21733..32835c90e 100644 --- a/pkg/mongodb/Tests/MongodbContextTest.php +++ b/pkg/mongodb/Tests/MongodbContextTest.php @@ -183,7 +183,7 @@ public function testShouldThrowNotSupportedOnCreateTemporaryQueueCall() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Client + * @return \PHPUnit\Framework\MockObject\MockObject|Client */ private function createClientMock() { diff --git a/pkg/mongodb/Tests/MongodbProducerTest.php b/pkg/mongodb/Tests/MongodbProducerTest.php index a62c8436e..8e8900cfd 100644 --- a/pkg/mongodb/Tests/MongodbProducerTest.php +++ b/pkg/mongodb/Tests/MongodbProducerTest.php @@ -43,7 +43,7 @@ public function testShouldThrowIfDestinationOfInvalidType() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|MongodbContext + * @return \PHPUnit\Framework\MockObject\MockObject|MongodbContext */ private function createContextMock() { diff --git a/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php b/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php index a7d1d8d8a..7d3cb44f4 100644 --- a/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php +++ b/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php @@ -145,7 +145,7 @@ public function testThrowsIfTryConsumeWithoutSubscribers() } /** - * @return MongodbContext|\PHPUnit_Framework_MockObject_MockObject + * @return MongodbContext|\PHPUnit\Framework\MockObject\MockObject */ private function createMongodbContextMock() { @@ -155,7 +155,7 @@ private function createMongodbContextMock() /** * @param mixed|null $queueName * - * @return Consumer|\PHPUnit_Framework_MockObject_MockObject + * @return Consumer|\PHPUnit\Framework\MockObject\MockObject */ private function createConsumerStub($queueName = null) { diff --git a/pkg/mongodb/composer.json b/pkg/mongodb/composer.json index ec5bfe34d..3801164b6 100644 --- a/pkg/mongodb/composer.json +++ b/pkg/mongodb/composer.json @@ -13,7 +13,7 @@ "php": "^7.1.3", "queue-interop/queue-interop": "^0.7|^0.8", "mongodb/mongodb": "^1.2", - "ext-mongodb": "^1.3" + "ext-mongodb": "^1.5" }, "require-dev": { "phpunit/phpunit": "~5.4.0", diff --git a/pkg/mongodb/phpunit.xml.dist b/pkg/mongodb/phpunit.xml.dist index 1f34af01d..8416ff838 100644 --- a/pkg/mongodb/phpunit.xml.dist +++ b/pkg/mongodb/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/monitoring/phpunit.xml.dist b/pkg/monitoring/phpunit.xml.dist index 6a6148ae4..10678a573 100644 --- a/pkg/monitoring/phpunit.xml.dist +++ b/pkg/monitoring/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/null/phpunit.xml.dist b/pkg/null/phpunit.xml.dist index 2fd4e20c3..2c7c8b1ff 100644 --- a/pkg/null/phpunit.xml.dist +++ b/pkg/null/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/pheanstalk/Tests/PheanstalkConsumerTest.php b/pkg/pheanstalk/Tests/PheanstalkConsumerTest.php index 7600e9921..c0138c726 100644 --- a/pkg/pheanstalk/Tests/PheanstalkConsumerTest.php +++ b/pkg/pheanstalk/Tests/PheanstalkConsumerTest.php @@ -222,7 +222,7 @@ public function testRequeueShouldThrowExceptionIfMessageHasNoJob() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Pheanstalk + * @return \PHPUnit\Framework\MockObject\MockObject|Pheanstalk */ private function createPheanstalkMock() { diff --git a/pkg/pheanstalk/Tests/PheanstalkContextTest.php b/pkg/pheanstalk/Tests/PheanstalkContextTest.php index fb92b6a72..9f5ac5812 100644 --- a/pkg/pheanstalk/Tests/PheanstalkContextTest.php +++ b/pkg/pheanstalk/Tests/PheanstalkContextTest.php @@ -73,7 +73,7 @@ public function testShouldDoConnectionDisconnectOnContextClose() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Pheanstalk + * @return \PHPUnit\Framework\MockObject\MockObject|Pheanstalk */ private function createPheanstalkMock() { diff --git a/pkg/pheanstalk/Tests/PheanstalkProducerTest.php b/pkg/pheanstalk/Tests/PheanstalkProducerTest.php index 7a8d0b483..60a19f627 100644 --- a/pkg/pheanstalk/Tests/PheanstalkProducerTest.php +++ b/pkg/pheanstalk/Tests/PheanstalkProducerTest.php @@ -11,6 +11,7 @@ use Interop\Queue\Exception\InvalidDestinationException; use Interop\Queue\Exception\InvalidMessageException; use Pheanstalk\Pheanstalk; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class PheanstalkProducerTest extends TestCase @@ -66,7 +67,7 @@ public function testShouldJsonEncodeMessageAndPutToExpectedTube() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Pheanstalk + * @return MockObject|Pheanstalk */ private function createPheanstalkMock() { diff --git a/pkg/pheanstalk/phpunit.xml.dist b/pkg/pheanstalk/phpunit.xml.dist index 4dca142e1..b24485336 100644 --- a/pkg/pheanstalk/phpunit.xml.dist +++ b/pkg/pheanstalk/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/rdkafka/Tests/RdKafkaConsumerTest.php b/pkg/rdkafka/Tests/RdKafkaConsumerTest.php index e35d97fc0..b40916c15 100644 --- a/pkg/rdkafka/Tests/RdKafkaConsumerTest.php +++ b/pkg/rdkafka/Tests/RdKafkaConsumerTest.php @@ -272,7 +272,7 @@ public function testShouldAllowGetPreviouslySetSerializer() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|KafkaConsumer + * @return \PHPUnit\Framework\MockObject\MockObject|KafkaConsumer */ private function createKafkaConsumerMock() { @@ -280,7 +280,7 @@ private function createKafkaConsumerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|RdKafkaContext + * @return \PHPUnit\Framework\MockObject\MockObject|RdKafkaContext */ private function createContextMock() { @@ -288,7 +288,7 @@ private function createContextMock() } /** - * @return Serializer|\PHPUnit_Framework_MockObject_MockObject|Serializer + * @return Serializer|\PHPUnit\Framework\MockObject\MockObject|Serializer */ private function createSerializerMock() { diff --git a/pkg/rdkafka/Tests/RdKafkaProducerTest.php b/pkg/rdkafka/Tests/RdKafkaProducerTest.php index 1f8e7db8b..7cc601aef 100644 --- a/pkg/rdkafka/Tests/RdKafkaProducerTest.php +++ b/pkg/rdkafka/Tests/RdKafkaProducerTest.php @@ -206,7 +206,7 @@ public function testShouldAllowSerializersToSerializeKeys() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|ProducerTopic + * @return \PHPUnit\Framework\MockObject\MockObject|ProducerTopic */ private function createKafkaTopicMock() { @@ -214,7 +214,7 @@ private function createKafkaTopicMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Producer + * @return \PHPUnit\Framework\MockObject\MockObject|Producer */ private function createKafkaProducerMock() { @@ -222,7 +222,7 @@ private function createKafkaProducerMock() } /** - * @return Serializer|\PHPUnit_Framework_MockObject_MockObject|Serializer + * @return Serializer|\PHPUnit\Framework\MockObject\MockObject|Serializer */ private function createSerializerMock() { diff --git a/pkg/rdkafka/phpunit.xml.dist b/pkg/rdkafka/phpunit.xml.dist index d899fd655..0f9bb33cc 100644 --- a/pkg/rdkafka/phpunit.xml.dist +++ b/pkg/rdkafka/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/redis/Tests/Functional/PRedisCommonUseCasesTest.php b/pkg/redis/Tests/Functional/PRedisCommonUseCasesTest.php index 8c95e47de..a63672da8 100644 --- a/pkg/redis/Tests/Functional/PRedisCommonUseCasesTest.php +++ b/pkg/redis/Tests/Functional/PRedisCommonUseCasesTest.php @@ -27,7 +27,7 @@ public function setUp() $this->context->deleteTopic($this->context->createTopic('enqueue.test_topic')); } - public function tearDown() + public function tearDown(): void { $this->context->close(); } diff --git a/pkg/redis/Tests/Functional/PRedisConsumptionUseCasesTest.php b/pkg/redis/Tests/Functional/PRedisConsumptionUseCasesTest.php index 87fca37fd..f748020f1 100644 --- a/pkg/redis/Tests/Functional/PRedisConsumptionUseCasesTest.php +++ b/pkg/redis/Tests/Functional/PRedisConsumptionUseCasesTest.php @@ -27,7 +27,7 @@ public function setUp() $this->context->deleteQueue($this->context->createQueue('enqueue.test_queue_reply')); } - public function tearDown() + public function tearDown(): void { $this->context->close(); } diff --git a/pkg/redis/Tests/Functional/PhpRedisCommonUseCasesTest.php b/pkg/redis/Tests/Functional/PhpRedisCommonUseCasesTest.php index 2d5559d34..41b403565 100644 --- a/pkg/redis/Tests/Functional/PhpRedisCommonUseCasesTest.php +++ b/pkg/redis/Tests/Functional/PhpRedisCommonUseCasesTest.php @@ -27,7 +27,7 @@ public function setUp() $this->context->deleteTopic($this->context->createTopic('enqueue.test_topic')); } - public function tearDown() + public function tearDown(): void { $this->context->close(); } diff --git a/pkg/redis/Tests/Functional/PhpRedisConsumptionUseCasesTest.php b/pkg/redis/Tests/Functional/PhpRedisConsumptionUseCasesTest.php index 50c639f92..d48e4bcb4 100644 --- a/pkg/redis/Tests/Functional/PhpRedisConsumptionUseCasesTest.php +++ b/pkg/redis/Tests/Functional/PhpRedisConsumptionUseCasesTest.php @@ -27,7 +27,7 @@ public function setUp() $this->context->deleteQueue($this->context->createQueue('enqueue.test_queue_reply')); } - public function tearDown() + public function tearDown(): void { $this->context->close(); } diff --git a/pkg/redis/Tests/RedisConsumerTest.php b/pkg/redis/Tests/RedisConsumerTest.php index 8c2b1afe0..ed67bd73b 100644 --- a/pkg/redis/Tests/RedisConsumerTest.php +++ b/pkg/redis/Tests/RedisConsumerTest.php @@ -291,7 +291,7 @@ public function testShouldCallRedisRPopAndReturnMessageIfOneInQueueOnReceiveNoWa } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Redis + * @return \PHPUnit\Framework\MockObject\MockObject|Redis */ private function createRedisMock() { @@ -299,7 +299,7 @@ private function createRedisMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|RedisProducer + * @return \PHPUnit\Framework\MockObject\MockObject|RedisProducer */ private function createProducerMock() { @@ -307,7 +307,7 @@ private function createProducerMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|RedisContext + * @return \PHPUnit\Framework\MockObject\MockObject|RedisContext */ private function createContextMock() { diff --git a/pkg/redis/Tests/RedisContextTest.php b/pkg/redis/Tests/RedisContextTest.php index 01ea67df5..0115f27b8 100644 --- a/pkg/redis/Tests/RedisContextTest.php +++ b/pkg/redis/Tests/RedisContextTest.php @@ -231,7 +231,7 @@ public function testShouldReturnExpectedSubscriptionConsumerInstance() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Redis + * @return \PHPUnit\Framework\MockObject\MockObject|Redis */ private function createRedisMock() { diff --git a/pkg/redis/Tests/RedisProducerTest.php b/pkg/redis/Tests/RedisProducerTest.php index daef46b61..fa7260311 100644 --- a/pkg/redis/Tests/RedisProducerTest.php +++ b/pkg/redis/Tests/RedisProducerTest.php @@ -104,7 +104,7 @@ public function testShouldCallZaddOnSendWithDeliveryDelay() ->with( 'aDestination:delayed', $this->isJson(), - $this->equalTo(time() + 5) + $this->equalTo(time() + 5, 1) ) ; @@ -128,7 +128,7 @@ public function testShouldCallZaddOnSendWithDeliveryDelay() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|RedisContext + * @return \PHPUnit\Framework\MockObject\MockObject|RedisContext */ private function createContextMock() { @@ -136,7 +136,7 @@ private function createContextMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Redis + * @return \PHPUnit\Framework\MockObject\MockObject|Redis */ private function createRedisMock() { diff --git a/pkg/redis/Tests/RedisSubscriptionConsumerTest.php b/pkg/redis/Tests/RedisSubscriptionConsumerTest.php index 3698ad2ea..ac8300cd2 100644 --- a/pkg/redis/Tests/RedisSubscriptionConsumerTest.php +++ b/pkg/redis/Tests/RedisSubscriptionConsumerTest.php @@ -142,7 +142,7 @@ public function testThrowsIfTryConsumeWithoutSubscribers() } /** - * @return RedisContext|\PHPUnit_Framework_MockObject_MockObject + * @return RedisContext|\PHPUnit\Framework\MockObject\MockObject */ private function createRedisContextMock() { @@ -152,7 +152,7 @@ private function createRedisContextMock() /** * @param mixed|null $queueName * - * @return Consumer|\PHPUnit_Framework_MockObject_MockObject + * @return Consumer|\PHPUnit\Framework\MockObject\MockObject */ private function createConsumerStub($queueName = null) { diff --git a/pkg/redis/phpunit.xml.dist b/pkg/redis/phpunit.xml.dist index 9c4467b56..6abcdf9f4 100644 --- a/pkg/redis/phpunit.xml.dist +++ b/pkg/redis/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/simple-client/composer.json b/pkg/simple-client/composer.json index 571cca783..18e87e351 100644 --- a/pkg/simple-client/composer.json +++ b/pkg/simple-client/composer.json @@ -10,14 +10,15 @@ "enqueue/enqueue": "^0.9", "queue-interop/amqp-interop": "^0.8", "queue-interop/queue-interop": "^0.7|^0.8", - "symfony/config": "^3.4|^4" + "symfony/config": "^4.3|^5" }, "require-dev": { - "phpunit/phpunit": "~5.5", + "phpunit/phpunit": "~7.5", "enqueue/test": "0.9.x-dev", "enqueue/amqp-ext": "0.9.x-dev", "enqueue/fs": "0.9.x-dev", - "enqueue/null": "0.9.x-dev" + "enqueue/null": "0.9.x-dev", + "symfony/yaml": "^4.3|^5" }, "support": { "email": "opensource@forma-pro.com", diff --git a/pkg/simple-client/phpunit.xml.dist b/pkg/simple-client/phpunit.xml.dist index e86476dec..57d353f74 100644 --- a/pkg/simple-client/phpunit.xml.dist +++ b/pkg/simple-client/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/sns/Tests/SnsProducerTest.php b/pkg/sns/Tests/SnsProducerTest.php index 62f8ae4cf..5f8784905 100644 --- a/pkg/sns/Tests/SnsProducerTest.php +++ b/pkg/sns/Tests/SnsProducerTest.php @@ -233,7 +233,7 @@ public function testShouldPublishWithMergedAttributes() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SnsContext + * @return \PHPUnit\Framework\MockObject\MockObject|SnsContext */ private function createSnsContextMock(): SnsContext { @@ -241,7 +241,7 @@ private function createSnsContextMock(): SnsContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SnsClient + * @return \PHPUnit\Framework\MockObject\MockObject|SnsClient */ private function createSnsClientMock(): SnsClient { diff --git a/pkg/sns/phpunit.xml.dist b/pkg/sns/phpunit.xml.dist index 3fe611e9c..e50e79f9a 100644 --- a/pkg/sns/phpunit.xml.dist +++ b/pkg/sns/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/snsqs/Tests/SnsQsProducerTest.php b/pkg/snsqs/Tests/SnsQsProducerTest.php index 336e32033..91b21d7bf 100644 --- a/pkg/snsqs/Tests/SnsQsProducerTest.php +++ b/pkg/snsqs/Tests/SnsQsProducerTest.php @@ -115,7 +115,7 @@ public function testShouldSendSqsMessageToSqsProducer() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SnsContext + * @return \PHPUnit\Framework\MockObject\MockObject|SnsContext */ private function createSnsContextMock(): SnsContext { @@ -123,7 +123,7 @@ private function createSnsContextMock(): SnsContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsContext + * @return \PHPUnit\Framework\MockObject\MockObject|SqsContext */ private function createSqsContextMock(): SqsContext { diff --git a/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveFromQueueTest.php b/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveFromQueueTest.php index 74fb5db29..ed199180d 100644 --- a/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveFromQueueTest.php +++ b/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveFromQueueTest.php @@ -15,7 +15,7 @@ class SnsQsSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec use RetryTrait; use SnsQsFactoryTrait; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveNoWaitFromQueueTest.php b/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveNoWaitFromQueueTest.php index 72e29eeae..53ae719b2 100644 --- a/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveNoWaitFromQueueTest.php +++ b/pkg/snsqs/Tests/Spec/SnsQsSendToAndReceiveNoWaitFromQueueTest.php @@ -15,7 +15,7 @@ class SnsQsSendToAndReceiveNoWaitFromQueueTest extends SendToAndReceiveNoWaitFro use RetryTrait; use SnsQsFactoryTrait; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveFromQueueSpec.php b/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveFromQueueSpec.php index f32e37a94..24206c9d8 100644 --- a/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveFromQueueSpec.php +++ b/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveFromQueueSpec.php @@ -15,7 +15,7 @@ class SnsQsSendToTopicAndReceiveFromQueueSpec extends SendToTopicAndReceiveFromQ use RetryTrait; use SnsQsFactoryTrait; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveNoWaitFromQueueTest.php b/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveNoWaitFromQueueTest.php index 5d404e4a3..e370c1f32 100644 --- a/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveNoWaitFromQueueTest.php +++ b/pkg/snsqs/Tests/Spec/SnsQsSendToTopicAndReceiveNoWaitFromQueueTest.php @@ -15,7 +15,7 @@ class SnsQsSendToTopicAndReceiveNoWaitFromQueueTest extends SendToTopicAndReceiv use RetryTrait; use SnsQsFactoryTrait; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/snsqs/phpunit.xml.dist b/pkg/snsqs/phpunit.xml.dist index e9b3b30e8..69fa7ebb8 100644 --- a/pkg/snsqs/phpunit.xml.dist +++ b/pkg/snsqs/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/sqs/Tests/Functional/SqsCommonUseCasesTest.php b/pkg/sqs/Tests/Functional/SqsCommonUseCasesTest.php index 5c6f11286..13b8809d7 100644 --- a/pkg/sqs/Tests/Functional/SqsCommonUseCasesTest.php +++ b/pkg/sqs/Tests/Functional/SqsCommonUseCasesTest.php @@ -39,7 +39,7 @@ protected function setUp() $this->context->declareQueue($this->queue); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendAndReceiveDelayedMessageFromQueueTest.php b/pkg/sqs/Tests/Spec/SqsSendAndReceiveDelayedMessageFromQueueTest.php index 710e918f3..357ed93eb 100644 --- a/pkg/sqs/Tests/Spec/SqsSendAndReceiveDelayedMessageFromQueueTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendAndReceiveDelayedMessageFromQueueTest.php @@ -24,7 +24,7 @@ class SqsSendAndReceiveDelayedMessageFromQueueTest extends SendAndReceiveDelayed */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromQueueTest.php b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromQueueTest.php index 1a3cdb54e..802d887ac 100644 --- a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromQueueTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromQueueTest.php @@ -24,7 +24,7 @@ class SqsSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromTopicTest.php b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromTopicTest.php index b66631233..ac57818aa 100644 --- a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromTopicTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromTopicTest.php @@ -24,7 +24,7 @@ class SqsSendToAndReceiveFromTopicTest extends SendToAndReceiveFromTopicSpec */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromQueueTest.php b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromQueueTest.php index 378e65c13..3f03006d9 100644 --- a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromQueueTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromQueueTest.php @@ -24,7 +24,7 @@ class SqsSendToAndReceiveNoWaitFromQueueTest extends SendToAndReceiveNoWaitFromQ */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromTopicTest.php b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromTopicTest.php index 175af9568..12a3c0c6e 100644 --- a/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromTopicTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendToAndReceiveNoWaitFromTopicTest.php @@ -24,7 +24,7 @@ class SqsSendToAndReceiveNoWaitFromTopicTest extends SendToAndReceiveNoWaitFromT */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveFromQueueTest.php b/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveFromQueueTest.php index 2f9c8b638..519db1be5 100644 --- a/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveFromQueueTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveFromQueueTest.php @@ -24,7 +24,7 @@ class SqsSendToTopicAndReceiveFromQueueTest extends SendToTopicAndReceiveFromQue */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveNoWaitFromQueueTest.php b/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveNoWaitFromQueueTest.php index b4cc5669f..317d7297c 100644 --- a/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveNoWaitFromQueueTest.php +++ b/pkg/sqs/Tests/Spec/SqsSendToTopicAndReceiveNoWaitFromQueueTest.php @@ -24,7 +24,7 @@ class SqsSendToTopicAndReceiveNoWaitFromQueueTest extends SendToTopicAndReceiveN */ private $context; - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/pkg/sqs/Tests/SqsConsumerTest.php b/pkg/sqs/Tests/SqsConsumerTest.php index 9fdded9e2..23e443653 100644 --- a/pkg/sqs/Tests/SqsConsumerTest.php +++ b/pkg/sqs/Tests/SqsConsumerTest.php @@ -448,7 +448,7 @@ public function testShouldReturnNullIfThereIsNoNewMessage() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsProducer + * @return \PHPUnit\Framework\MockObject\MockObject|SqsProducer */ private function createProducerMock(): SqsProducer { @@ -456,7 +456,7 @@ private function createProducerMock(): SqsProducer } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsClient + * @return \PHPUnit\Framework\MockObject\MockObject|SqsClient */ private function createSqsClientMock(): SqsClient { @@ -464,7 +464,7 @@ private function createSqsClientMock(): SqsClient } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsContext + * @return \PHPUnit\Framework\MockObject\MockObject|SqsContext */ private function createContextMock(): SqsContext { diff --git a/pkg/sqs/Tests/SqsContextTest.php b/pkg/sqs/Tests/SqsContextTest.php index 1f5fcf239..75970bbad 100644 --- a/pkg/sqs/Tests/SqsContextTest.php +++ b/pkg/sqs/Tests/SqsContextTest.php @@ -435,7 +435,7 @@ public function testShouldThrowExceptionIfGetQueueUrlResultHasNoQueueUrlProperty } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsClient + * @return \PHPUnit\Framework\MockObject\MockObject|SqsClient */ private function createSqsClientMock(): SqsClient { diff --git a/pkg/sqs/Tests/SqsProducerTest.php b/pkg/sqs/Tests/SqsProducerTest.php index 54729adbd..1bda62c48 100644 --- a/pkg/sqs/Tests/SqsProducerTest.php +++ b/pkg/sqs/Tests/SqsProducerTest.php @@ -221,7 +221,7 @@ public function testShouldSendDelayedMessage() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsContext + * @return \PHPUnit\Framework\MockObject\MockObject|SqsContext */ private function createSqsContextMock(): SqsContext { @@ -229,7 +229,7 @@ private function createSqsContextMock(): SqsContext } /** - * @return \PHPUnit_Framework_MockObject_MockObject|SqsClient + * @return \PHPUnit\Framework\MockObject\MockObject|SqsClient */ private function createSqsClientMock(): SqsClient { diff --git a/pkg/sqs/phpunit.xml.dist b/pkg/sqs/phpunit.xml.dist index 7c026b4e6..1810857f2 100644 --- a/pkg/sqs/phpunit.xml.dist +++ b/pkg/sqs/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/stomp/Tests/BufferedStompClientTest.php b/pkg/stomp/Tests/BufferedStompClientTest.php index 9e7bfa8df..8732170e9 100644 --- a/pkg/stomp/Tests/BufferedStompClientTest.php +++ b/pkg/stomp/Tests/BufferedStompClientTest.php @@ -179,7 +179,7 @@ public function testShouldAddFirstFrameToBufferIfSubscriptionNotEqualAndReturnSe } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Connection + * @return \PHPUnit\Framework\MockObject\MockObject|Connection */ private function createStompConnectionMock() { diff --git a/pkg/stomp/Tests/Functional/StompCommonUseCasesTest.php b/pkg/stomp/Tests/Functional/StompCommonUseCasesTest.php index 42250ed96..e2175b8af 100644 --- a/pkg/stomp/Tests/Functional/StompCommonUseCasesTest.php +++ b/pkg/stomp/Tests/Functional/StompCommonUseCasesTest.php @@ -27,7 +27,7 @@ public function setUp() $this->removeQueue('stomp.test'); } - public function tearDown() + public function tearDown(): void { $this->stompContext->close(); } diff --git a/pkg/stomp/Tests/Functional/StompConsumptionUseCasesTest.php b/pkg/stomp/Tests/Functional/StompConsumptionUseCasesTest.php index 3ab8498ab..36357ca21 100644 --- a/pkg/stomp/Tests/Functional/StompConsumptionUseCasesTest.php +++ b/pkg/stomp/Tests/Functional/StompConsumptionUseCasesTest.php @@ -35,7 +35,7 @@ public function setUp() $this->removeQueue('stomp.test'); } - public function tearDown() + public function tearDown(): void { $this->stompContext->close(); } diff --git a/pkg/stomp/Tests/Functional/StompRpcUseCasesTest.php b/pkg/stomp/Tests/Functional/StompRpcUseCasesTest.php index f054ffdd7..4c06d59b1 100644 --- a/pkg/stomp/Tests/Functional/StompRpcUseCasesTest.php +++ b/pkg/stomp/Tests/Functional/StompRpcUseCasesTest.php @@ -30,7 +30,7 @@ public function setUp() $this->removeQueue('stomp.rpc.reply_test'); } - public function tearDown() + public function tearDown(): void { $this->stompContext->close(); } diff --git a/pkg/stomp/Tests/StompConsumerTest.php b/pkg/stomp/Tests/StompConsumerTest.php index 19b16096e..67423f76c 100644 --- a/pkg/stomp/Tests/StompConsumerTest.php +++ b/pkg/stomp/Tests/StompConsumerTest.php @@ -540,7 +540,7 @@ public function testShouldUseTempQueueNameAsSubscriptionId() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Protocol + * @return \PHPUnit\Framework\MockObject\MockObject|Protocol */ private function createStompProtocolMock() { @@ -548,7 +548,7 @@ private function createStompProtocolMock() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|BufferedStompClient + * @return \PHPUnit\Framework\MockObject\MockObject|BufferedStompClient */ private function createStompClientMock() { diff --git a/pkg/stomp/Tests/StompContextTest.php b/pkg/stomp/Tests/StompContextTest.php index 69b577e85..89fc8825b 100644 --- a/pkg/stomp/Tests/StompContextTest.php +++ b/pkg/stomp/Tests/StompContextTest.php @@ -233,7 +233,7 @@ public function testShouldGetBufferedStompClient() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|BufferedStompClient + * @return \PHPUnit\Framework\MockObject\MockObject|BufferedStompClient */ private function createStompClientMock() { diff --git a/pkg/stomp/Tests/StompProducerTest.php b/pkg/stomp/Tests/StompProducerTest.php index a197a5870..e1e542709 100644 --- a/pkg/stomp/Tests/StompProducerTest.php +++ b/pkg/stomp/Tests/StompProducerTest.php @@ -100,7 +100,7 @@ public function testShouldEncodeMessageHeadersAndProperties() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Client + * @return \PHPUnit\Framework\MockObject\MockObject|Client */ private function createStompClientMock() { diff --git a/pkg/stomp/phpunit.xml.dist b/pkg/stomp/phpunit.xml.dist index a9291bf93..6bbac7035 100644 --- a/pkg/stomp/phpunit.xml.dist +++ b/pkg/stomp/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > diff --git a/pkg/test/GpsExtension.php b/pkg/test/GpsExtension.php index 6d9c412b6..2b03ef64b 100644 --- a/pkg/test/GpsExtension.php +++ b/pkg/test/GpsExtension.php @@ -4,13 +4,14 @@ use Enqueue\Gps\GpsConnectionFactory; use Enqueue\Gps\GpsContext; +use PHPUnit\Framework\SkippedTestError; trait GpsExtension { private function buildGpsContext(): GpsContext { if (false == getenv('GPS_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } $config = getenv('GPS_DSN'); diff --git a/pkg/test/RabbitmqAmqpExtension.php b/pkg/test/RabbitmqAmqpExtension.php index 358147851..28099f12b 100644 --- a/pkg/test/RabbitmqAmqpExtension.php +++ b/pkg/test/RabbitmqAmqpExtension.php @@ -4,6 +4,7 @@ use Enqueue\AmqpExt\AmqpConnectionFactory; use Enqueue\AmqpExt\AmqpContext; +use PHPUnit\Framework\SkippedTestError; trait RabbitmqAmqpExtension { @@ -13,7 +14,7 @@ trait RabbitmqAmqpExtension private function buildAmqpContext() { if (false == $dsn = getenv('AMQP_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } return (new AmqpConnectionFactory($dsn))->createContext(); diff --git a/pkg/test/RabbitmqStompExtension.php b/pkg/test/RabbitmqStompExtension.php index 2ce2dfaa0..d381d1fcf 100644 --- a/pkg/test/RabbitmqStompExtension.php +++ b/pkg/test/RabbitmqStompExtension.php @@ -4,13 +4,14 @@ use Enqueue\Stomp\StompConnectionFactory; use Enqueue\Stomp\StompContext; +use PHPUnit\Framework\SkippedTestError; trait RabbitmqStompExtension { private function buildStompContext(): StompContext { if (false == $dsn = getenv('RABITMQ_STOMP_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } return (new StompConnectionFactory($dsn))->createContext(); diff --git a/pkg/test/RedisExtension.php b/pkg/test/RedisExtension.php index cb32382f9..86586d16b 100644 --- a/pkg/test/RedisExtension.php +++ b/pkg/test/RedisExtension.php @@ -6,13 +6,14 @@ use Enqueue\Redis\PRedis; use Enqueue\Redis\RedisConnectionFactory; use Enqueue\Redis\RedisContext; +use PHPUnit\Framework\SkippedTestError; trait RedisExtension { private function buildPhpRedisContext(): RedisContext { if (false == getenv('PHPREDIS_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } $config = getenv('PHPREDIS_DSN'); @@ -28,7 +29,7 @@ private function buildPhpRedisContext(): RedisContext private function buildPRedisContext(): RedisContext { if (false == getenv('PREDIS_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } $config = getenv('PREDIS_DSN'); diff --git a/pkg/test/RetryTrait.php b/pkg/test/RetryTrait.php index de17565bd..17c96ae89 100644 --- a/pkg/test/RetryTrait.php +++ b/pkg/test/RetryTrait.php @@ -2,9 +2,12 @@ namespace Enqueue\Test; +use PHPUnit\Framework\IncompleteTestError; +use PHPUnit\Framework\SkippedTestError; + trait RetryTrait { - public function runBare() + public function runBare(): void { $e = null; @@ -22,9 +25,9 @@ public function runBare() parent::runBare(); return; - } catch (\PHPUnit_Framework_IncompleteTestError $e) { + } catch (IncompleteTestError $e) { throw $e; - } catch (\PHPUnit_Framework_SkippedTestError $e) { + } catch (SkippedTestError $e) { throw $e; } catch (\Throwable $e) { // last one thrown below diff --git a/pkg/test/SnsExtension.php b/pkg/test/SnsExtension.php index 6c01abe2f..050f212dd 100644 --- a/pkg/test/SnsExtension.php +++ b/pkg/test/SnsExtension.php @@ -4,13 +4,14 @@ use Enqueue\Sns\SnsConnectionFactory; use Enqueue\Sns\SnsContext; +use PHPUnit\Framework\SkippedTestError; trait SnsExtension { private function buildSqsContext(): SnsContext { if (false == $dsn = getenv('SNS_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } return (new SnsConnectionFactory($dsn))->createContext(); diff --git a/pkg/test/SnsQsExtension.php b/pkg/test/SnsQsExtension.php index 719f5ce58..6dc7dc9d9 100644 --- a/pkg/test/SnsQsExtension.php +++ b/pkg/test/SnsQsExtension.php @@ -4,13 +4,14 @@ use Enqueue\SnsQs\SnsQsConnectionFactory; use Enqueue\SnsQs\SnsQsContext; +use PHPUnit\Framework\SkippedTestError; trait SnsQsExtension { private function buildSnsQsContext(): SnsQsContext { if (false == $dsn = getenv('SNSQS_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } return (new SnsQsConnectionFactory($dsn))->createContext(); diff --git a/pkg/test/SqsExtension.php b/pkg/test/SqsExtension.php index 3cc17e47f..c00b42e68 100644 --- a/pkg/test/SqsExtension.php +++ b/pkg/test/SqsExtension.php @@ -4,13 +4,14 @@ use Enqueue\Sqs\SqsConnectionFactory; use Enqueue\Sqs\SqsContext; +use PHPUnit\Framework\SkippedTestError; trait SqsExtension { private function buildSqsContext(): SqsContext { if (false == $dsn = getenv('SQS_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } return (new SqsConnectionFactory($dsn))->createContext(); diff --git a/pkg/test/WampExtension.php b/pkg/test/WampExtension.php index eab5d42b7..5b17fe7cf 100644 --- a/pkg/test/WampExtension.php +++ b/pkg/test/WampExtension.php @@ -4,13 +4,14 @@ use Enqueue\Wamp\WampConnectionFactory; use Enqueue\Wamp\WampContext; +use PHPUnit\Framework\SkippedTestError; trait WampExtension { private function buildWampContext(): WampContext { if (false == $dsn = getenv('WAMP_DSN')) { - throw new \PHPUnit_Framework_SkippedTestError('Functional tests are not allowed in this environment'); + throw new SkippedTestError('Functional tests are not allowed in this environment'); } return (new WampConnectionFactory($dsn))->createContext(); diff --git a/pkg/wamp/README.md b/pkg/wamp/README.md index 22b32d4e2..67f5c9cef 100644 --- a/pkg/wamp/README.md +++ b/pkg/wamp/README.md @@ -14,7 +14,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made [![Total Downloads](https://poser.pugx.org/enqueue/wamp/d/total.png)](https://packagist.org/packages/enqueue/wamp) [![Latest Stable Version](https://poser.pugx.org/enqueue/wamp/version.png)](https://packagist.org/packages/enqueue/wamp) -This is an implementation of [queue interop](https://github.com/queue-interop/queue-interop). It uses [Thruway](https://github.com/voryx/Thruway) internally. +This is an implementation of [queue interop](https://github.com/queue-interop/queue-interop). It uses [Thruway](https://github.com/thruway/client) internally. ## Resources diff --git a/pkg/wamp/composer.json b/pkg/wamp/composer.json index 28c2c7065..379e60d3e 100644 --- a/pkg/wamp/composer.json +++ b/pkg/wamp/composer.json @@ -9,8 +9,8 @@ "php": "^7.1.3", "queue-interop/queue-interop": "^0.7|^0.8", "enqueue/dsn": "^0.9", - "thruway/pawl-transport": "^0.5.0", - "voryx/thruway": "^0.5.3" + "thruway/client": "^0.5.0", + "thruway/pawl-transport": "^0.5.0" }, "require-dev": { "phpunit/phpunit": "~5.4.0", diff --git a/pkg/wamp/phpunit.xml.dist b/pkg/wamp/phpunit.xml.dist index 717a3c6db..1648880fe 100644 --- a/pkg/wamp/phpunit.xml.dist +++ b/pkg/wamp/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" >