diff --git a/pkg/enqueue-bundle/.travis.yml b/pkg/enqueue-bundle/.travis.yml index 566e0af94..880a93f5e 100644 --- a/pkg/enqueue-bundle/.travis.yml +++ b/pkg/enqueue-bundle/.travis.yml @@ -5,9 +5,15 @@ git: language: php + php: - - '5.6' - - '7.0' + - '7.1' + +services: + - mongodb + +before_install: + - echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini cache: directories: diff --git a/pkg/enqueue-bundle/Tests/Functional/Client/ConsumeMessagesCommandTest.php b/pkg/enqueue-bundle/Tests/Functional/Client/ConsumeMessagesCommandTest.php index 7dc45a4a6..5af610971 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Client/ConsumeMessagesCommandTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Client/ConsumeMessagesCommandTest.php @@ -12,7 +12,7 @@ class ConsumeMessagesCommandTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $command = $this->container->get(ConsumeMessagesCommand::class); + $command = static::$container->get(ConsumeMessagesCommand::class); $this->assertInstanceOf(ConsumeMessagesCommand::class, $command); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Client/DriverTest.php b/pkg/enqueue-bundle/Tests/Functional/Client/DriverTest.php index 2900bcdd9..d4b290fb3 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Client/DriverTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Client/DriverTest.php @@ -12,7 +12,7 @@ class DriverTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $driver = $this->container->get('enqueue.client.driver'); + $driver = static::$container->get('enqueue.client.driver'); $this->assertInstanceOf(DriverInterface::class, $driver); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Client/ProduceMessageCommandTest.php b/pkg/enqueue-bundle/Tests/Functional/Client/ProduceMessageCommandTest.php index d8ae433c8..0873705e7 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Client/ProduceMessageCommandTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Client/ProduceMessageCommandTest.php @@ -12,7 +12,7 @@ class ProduceMessageCommandTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $command = $this->container->get(ProduceMessageCommand::class); + $command = static::$container->get(ProduceMessageCommand::class); $this->assertInstanceOf(ProduceMessageCommand::class, $command); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php b/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php index 1494c6930..971b803ef 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Client/ProducerTest.php @@ -20,27 +20,27 @@ public function setUp() { parent::setUp(); - $this->container->get(Producer::class)->clearTraces(); + static::$container->get(Producer::class)->clearTraces(); } public function tearDown() { parent::tearDown(); - $this->container->get(Producer::class)->clearTraces(); + static::$container->get(Producer::class)->clearTraces(); } public function testCouldBeGetFromContainerAsService() { - $messageProducer = $this->container->get(Producer::class); + $messageProducer = static::$container->get(Producer::class); $this->assertInstanceOf(ProducerInterface::class, $messageProducer); } public function testCouldBeGetFromContainerAsShortenAlias() { - $messageProducer = $this->container->get(Producer::class); - $aliasMessageProducer = $this->container->get('enqueue.producer'); + $messageProducer = static::$container->get(Producer::class); + $aliasMessageProducer = static::$container->get('enqueue.producer'); $this->assertSame($messageProducer, $aliasMessageProducer); } @@ -48,7 +48,7 @@ public function testCouldBeGetFromContainerAsShortenAlias() public function testShouldSendEvent() { /** @var ProducerInterface $producer */ - $producer = $this->container->get(Producer::class); + $producer = static::$container->get(Producer::class); $producer->sendEvent('theTopic', 'theMessage'); @@ -61,7 +61,7 @@ public function testShouldSendEvent() public function testShouldSendCommandWithoutNeedForReply() { /** @var ProducerInterface $producer */ - $producer = $this->container->get(Producer::class); + $producer = static::$container->get(Producer::class); $result = $producer->sendCommand('theCommand', 'theMessage', false); @@ -76,7 +76,7 @@ public function testShouldSendCommandWithoutNeedForReply() public function testShouldSendMessageInstanceAsCommandWithoutNeedForReply() { /** @var ProducerInterface $producer */ - $producer = $this->container->get(Producer::class); + $producer = static::$container->get(Producer::class); $message = new Message('theMessage'); @@ -99,7 +99,7 @@ public function testShouldSendMessageInstanceAsCommandWithoutNeedForReply() public function testShouldSendExclusiveCommandWithNeedForReply() { /** @var ProducerInterface $producer */ - $producer = $this->container->get(Producer::class); + $producer = static::$container->get(Producer::class); $message = new Message('theMessage'); @@ -122,7 +122,7 @@ public function testShouldSendExclusiveCommandWithNeedForReply() public function testShouldSendMessageInstanceCommandWithNeedForReply() { /** @var ProducerInterface $producer */ - $producer = $this->container->get(Producer::class); + $producer = static::$container->get(Producer::class); $message = new Message('theMessage'); @@ -147,6 +147,6 @@ public function testShouldSendMessageInstanceCommandWithNeedForReply() */ private function getTraceableProducer() { - return $this->container->get(Producer::class); + return static::$container->get(Producer::class); } } diff --git a/pkg/enqueue-bundle/Tests/Functional/Client/SpoolProducerTest.php b/pkg/enqueue-bundle/Tests/Functional/Client/SpoolProducerTest.php index 1ed461997..c8a1eaa27 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Client/SpoolProducerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Client/SpoolProducerTest.php @@ -12,7 +12,7 @@ class SpoolProducerTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $producer = $this->container->get(SpoolProducer::class); + $producer = static::$container->get(SpoolProducer::class); $this->assertInstanceOf(SpoolProducer::class, $producer); } @@ -22,8 +22,8 @@ public function testCouldBeGetFromContainerAsService() */ public function testCouldBeGetFromContainerAsShortenAlias() { - $producer = $this->container->get('enqueue.client.spool_producer'); - $aliasProducer = $this->container->get('enqueue.spool_producer'); + $producer = static::$container->get('enqueue.client.spool_producer'); + $aliasProducer = static::$container->get('enqueue.spool_producer'); $this->assertSame($producer, $aliasProducer); } diff --git a/pkg/enqueue-bundle/Tests/Functional/ConsumeMessagesCommandTest.php b/pkg/enqueue-bundle/Tests/Functional/ConsumeMessagesCommandTest.php index e372d960d..d9313c4c5 100644 --- a/pkg/enqueue-bundle/Tests/Functional/ConsumeMessagesCommandTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/ConsumeMessagesCommandTest.php @@ -11,7 +11,7 @@ class ConsumeMessagesCommandTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $command = $this->container->get(ConsumeMessagesCommand::class); + $command = static::$container->get(ConsumeMessagesCommand::class); $this->assertInstanceOf(ConsumeMessagesCommand::class, $command); } diff --git a/pkg/enqueue-bundle/Tests/Functional/ContextTest.php b/pkg/enqueue-bundle/Tests/Functional/ContextTest.php index 8b317c6c4..44c141acd 100644 --- a/pkg/enqueue-bundle/Tests/Functional/ContextTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/ContextTest.php @@ -11,7 +11,7 @@ class ContextTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $connection = $this->container->get('enqueue.transport.context'); + $connection = static::$container->get('enqueue.transport.context'); $this->assertInstanceOf(PsrContext::class, $connection); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php index a802d2000..cb1cf7b2e 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncListenerTest.php @@ -20,7 +20,7 @@ public function setUp() parent::setUp(); /** @var AsyncListener $asyncListener */ - $asyncListener = $this->container->get('enqueue.events.async_listener'); + $asyncListener = static::$container->get('enqueue.events.async_listener'); $asyncListener->resetSyncMode(); } @@ -28,12 +28,12 @@ public function setUp() public function testShouldNotCallRealListenerIfMarkedAsAsync() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_dispatcher'); + $dispatcher = static::$container->get('event_dispatcher'); $dispatcher->dispatch('test_async', new GenericEvent('aSubject')); /** @var TestAsyncListener $listener */ - $listener = $this->container->get('test_async_listener'); + $listener = static::$container->get('test_async_listener'); $this->assertEmpty($listener->calls); } @@ -41,14 +41,14 @@ public function testShouldNotCallRealListenerIfMarkedAsAsync() public function testShouldSendMessageToExpectedCommandInsteadOfCallingRealListener() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_dispatcher'); + $dispatcher = static::$container->get('event_dispatcher'); $event = new GenericEvent('theSubject', ['fooArg' => 'fooVal']); $dispatcher->dispatch('test_async', $event); /** @var TraceableProducer $producer */ - $producer = $this->container->get('enqueue.producer'); + $producer = static::$container->get('enqueue.producer'); $traces = $producer->getCommandTraces('symfony_events'); @@ -61,14 +61,14 @@ public function testShouldSendMessageToExpectedCommandInsteadOfCallingRealListen public function testShouldSendMessageForEveryDispatchCall() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_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'])); /** @var TraceableProducer $producer */ - $producer = $this->container->get('enqueue.producer'); + $producer = static::$container->get('enqueue.producer'); $traces = $producer->getCommandTraces('symfony_events'); @@ -78,7 +78,7 @@ public function testShouldSendMessageForEveryDispatchCall() public function testShouldSendMessageIfDispatchedFromInsideListener() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_dispatcher'); + $dispatcher = static::$container->get('event_dispatcher'); $dispatcher->addListener('foo', function (Event $event, $eventName, EventDispatcherInterface $dispatcher) { $dispatcher->dispatch('test_async', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); @@ -87,7 +87,7 @@ public function testShouldSendMessageIfDispatchedFromInsideListener() $dispatcher->dispatch('foo'); /** @var TraceableProducer $producer */ - $producer = $this->container->get('enqueue.producer'); + $producer = static::$container->get('enqueue.producer'); $traces = $producer->getCommandTraces('symfony_events'); diff --git a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php index 44fb960e9..244782c30 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php @@ -23,7 +23,7 @@ public function setUp() parent::setUp(); /** @var AsyncListener $asyncListener */ - $asyncListener = $this->container->get('enqueue.events.async_listener'); + $asyncListener = static::$container->get('enqueue.events.async_listener'); $asyncListener->resetSyncMode(); } @@ -31,7 +31,7 @@ public function setUp() public function testCouldBeGetFromContainerAsService() { /** @var AsyncProcessor $processor */ - $processor = $this->container->get('enqueue.events.async_processor'); + $processor = static::$container->get('enqueue.events.async_processor'); $this->assertInstanceOf(AsyncProcessor::class, $processor); } @@ -39,7 +39,7 @@ public function testCouldBeGetFromContainerAsService() public function testShouldRejectIfMessageDoesNotContainEventNameProperty() { /** @var AsyncProcessor $processor */ - $processor = $this->container->get('enqueue.events.async_processor'); + $processor = static::$container->get('enqueue.events.async_processor'); $message = new NullMessage(); @@ -49,7 +49,7 @@ public function testShouldRejectIfMessageDoesNotContainEventNameProperty() public function testShouldRejectIfMessageDoesNotContainTransformerNameProperty() { /** @var AsyncProcessor $processor */ - $processor = $this->container->get('enqueue.events.async_processor'); + $processor = static::$container->get('enqueue.events.async_processor'); $message = new NullMessage(); $message->setProperty('event_name', 'anEventName'); @@ -60,7 +60,7 @@ public function testShouldRejectIfMessageDoesNotContainTransformerNameProperty() public function testShouldCallRealListener() { /** @var AsyncProcessor $processor */ - $processor = $this->container->get('enqueue.events.async_processor'); + $processor = static::$container->get('enqueue.events.async_processor'); $message = new NullMessage(); $message->setProperty('event_name', 'test_async'); @@ -73,7 +73,7 @@ public function testShouldCallRealListener() $this->assertEquals(PsrProcessor::ACK, $processor->process($message, new NullContext())); /** @var TestAsyncListener $listener */ - $listener = $this->container->get('test_async_listener'); + $listener = static::$container->get('test_async_listener'); $this->assertNotEmpty($listener->calls); @@ -83,7 +83,7 @@ public function testShouldCallRealListener() $this->assertEquals('test_async', $listener->calls[0][1]); $this->assertSame( - $this->container->get('enqueue.events.event_dispatcher'), + static::$container->get('enqueue.events.event_dispatcher'), $listener->calls[0][2] ); } @@ -91,7 +91,7 @@ public function testShouldCallRealListener() public function testShouldCallRealSubscriber() { /** @var AsyncProcessor $processor */ - $processor = $this->container->get('enqueue.events.async_processor'); + $processor = static::$container->get('enqueue.events.async_processor'); $message = new NullMessage(); $message->setProperty('event_name', 'test_async_subscriber'); @@ -104,7 +104,7 @@ public function testShouldCallRealSubscriber() $this->assertEquals(PsrProcessor::ACK, $processor->process($message, new NullContext())); /** @var TestAsyncSubscriber $subscriber */ - $subscriber = $this->container->get('test_async_subscriber'); + $subscriber = static::$container->get('test_async_subscriber'); $this->assertNotEmpty($subscriber->calls); @@ -114,7 +114,7 @@ public function testShouldCallRealSubscriber() $this->assertEquals('test_async_subscriber', $subscriber->calls[0][1]); $this->assertSame( - $this->container->get('enqueue.events.event_dispatcher'), + static::$container->get('enqueue.events.event_dispatcher'), $subscriber->calls[0][2] ); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php index 7a1979b15..4d4eb9240 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncSubscriberTest.php @@ -20,7 +20,7 @@ public function setUp() parent::setUp(); /** @var AsyncListener $asyncListener */ - $asyncListener = $this->container->get('enqueue.events.async_listener'); + $asyncListener = static::$container->get('enqueue.events.async_listener'); $asyncListener->resetSyncMode(); } @@ -28,12 +28,12 @@ public function setUp() public function testShouldNotCallRealSubscriberIfMarkedAsAsync() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_dispatcher'); + $dispatcher = static::$container->get('event_dispatcher'); $dispatcher->dispatch('test_async_subscriber', new GenericEvent('aSubject')); /** @var TestAsyncListener $listener */ - $listener = $this->container->get('test_async_subscriber'); + $listener = static::$container->get('test_async_subscriber'); $this->assertEmpty($listener->calls); } @@ -41,14 +41,14 @@ public function testShouldNotCallRealSubscriberIfMarkedAsAsync() public function testShouldSendMessageToExpectedTopicInsteadOfCallingRealSubscriber() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_dispatcher'); + $dispatcher = static::$container->get('event_dispatcher'); $event = new GenericEvent('theSubject', ['fooArg' => 'fooVal']); $dispatcher->dispatch('test_async_subscriber', $event); /** @var TraceableProducer $producer */ - $producer = $this->container->get('enqueue.producer'); + $producer = static::$container->get('enqueue.producer'); $traces = $producer->getCommandTraces('symfony_events'); @@ -61,14 +61,14 @@ public function testShouldSendMessageToExpectedTopicInsteadOfCallingRealSubscrib public function testShouldSendMessageForEveryDispatchCall() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_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'])); /** @var TraceableProducer $producer */ - $producer = $this->container->get('enqueue.producer'); + $producer = static::$container->get('enqueue.producer'); $traces = $producer->getCommandTraces('symfony_events'); @@ -78,7 +78,7 @@ public function testShouldSendMessageForEveryDispatchCall() public function testShouldSendMessageIfDispatchedFromInsideListener() { /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->container->get('event_dispatcher'); + $dispatcher = static::$container->get('event_dispatcher'); $dispatcher->addListener('foo', function (Event $event, $eventName, EventDispatcherInterface $dispatcher) { $dispatcher->dispatch('test_async_subscriber', new GenericEvent('theSubject', ['fooArg' => 'fooVal'])); @@ -87,7 +87,7 @@ public function testShouldSendMessageIfDispatchedFromInsideListener() $dispatcher->dispatch('foo'); /** @var TraceableProducer $producer */ - $producer = $this->container->get('enqueue.producer'); + $producer = static::$container->get('enqueue.producer'); $traces = $producer->getCommandTraces('symfony_events'); diff --git a/pkg/enqueue-bundle/Tests/Functional/Job/CalculateRootJobStatusProcessorTest.php b/pkg/enqueue-bundle/Tests/Functional/Job/CalculateRootJobStatusProcessorTest.php index fdc3471b8..01346ad8c 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Job/CalculateRootJobStatusProcessorTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Job/CalculateRootJobStatusProcessorTest.php @@ -12,7 +12,7 @@ class CalculateRootJobStatusProcessorTest extends WebTestCase { public function testCouldBeConstructedByContainer() { - $instance = $this->container->get(CalculateRootJobStatusProcessor::class); + $instance = static::$container->get(CalculateRootJobStatusProcessor::class); $this->assertInstanceOf(CalculateRootJobStatusProcessor::class, $instance); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Job/DependentJobServiceTest.php b/pkg/enqueue-bundle/Tests/Functional/Job/DependentJobServiceTest.php index 00974bb88..1aec06410 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Job/DependentJobServiceTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Job/DependentJobServiceTest.php @@ -12,7 +12,7 @@ class DependentJobServiceTest extends WebTestCase { public function testCouldBeConstructedByContainer() { - $instance = $this->container->get(DependentJobService::class); + $instance = static::$container->get(DependentJobService::class); $this->assertInstanceOf(DependentJobService::class, $instance); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Job/JobRunnerTest.php b/pkg/enqueue-bundle/Tests/Functional/Job/JobRunnerTest.php index 6e1320b8c..4aa647f77 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Job/JobRunnerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Job/JobRunnerTest.php @@ -12,7 +12,7 @@ class JobRunnerTest extends WebTestCase { public function testCouldBeConstructedByContainer() { - $instance = $this->container->get(JobRunner::class); + $instance = static::$container->get(JobRunner::class); $this->assertInstanceOf(JobRunner::class, $instance); } diff --git a/pkg/enqueue-bundle/Tests/Functional/Job/JobStorageTest.php b/pkg/enqueue-bundle/Tests/Functional/Job/JobStorageTest.php index e34d9dab4..650326ad8 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Job/JobStorageTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Job/JobStorageTest.php @@ -12,7 +12,7 @@ class JobStorageTest extends WebTestCase { public function testCouldGetJobStorageAsServiceFromContainer() { - $instance = $this->container->get(JobStorage::class); + $instance = static::$container->get(JobStorage::class); $this->assertInstanceOf(JobStorage::class, $instance); } diff --git a/pkg/enqueue-bundle/Tests/Functional/QueueConsumerTest.php b/pkg/enqueue-bundle/Tests/Functional/QueueConsumerTest.php index 415fd9842..1c0b16a56 100644 --- a/pkg/enqueue-bundle/Tests/Functional/QueueConsumerTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/QueueConsumerTest.php @@ -11,7 +11,7 @@ class QueueConsumerTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $queueConsumer = $this->container->get(QueueConsumer::class); + $queueConsumer = static::$container->get(QueueConsumer::class); $this->assertInstanceOf(QueueConsumer::class, $queueConsumer); } diff --git a/pkg/enqueue-bundle/Tests/Functional/QueueRegistryTest.php b/pkg/enqueue-bundle/Tests/Functional/QueueRegistryTest.php index 5db4f3105..d608b8f05 100644 --- a/pkg/enqueue-bundle/Tests/Functional/QueueRegistryTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/QueueRegistryTest.php @@ -11,7 +11,7 @@ class QueueRegistryTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $connection = $this->container->get(QueueMetaRegistry::class); + $connection = static::$container->get(QueueMetaRegistry::class); $this->assertInstanceOf(QueueMetaRegistry::class, $connection); } diff --git a/pkg/enqueue-bundle/Tests/Functional/QueuesCommandTest.php b/pkg/enqueue-bundle/Tests/Functional/QueuesCommandTest.php index b4fce6140..53a008656 100644 --- a/pkg/enqueue-bundle/Tests/Functional/QueuesCommandTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/QueuesCommandTest.php @@ -14,14 +14,14 @@ class QueuesCommandTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $command = $this->container->get(QueuesCommand::class); + $command = static::$container->get(QueuesCommand::class); $this->assertInstanceOf(QueuesCommand::class, $command); } public function testShouldDisplayRegisteredQueues() { - $command = $this->container->get(QueuesCommand::class); + $command = static::$container->get(QueuesCommand::class); $tester = new CommandTester($command); $tester->execute([]); @@ -43,7 +43,7 @@ public function testShouldDisplayRegisteredQueues() public function testShouldDisplayRegisteredCommand() { - $command = $this->container->get(QueuesCommand::class); + $command = static::$container->get(QueuesCommand::class); $tester = new CommandTester($command); $tester->execute([]); diff --git a/pkg/enqueue-bundle/Tests/Functional/RpcClientTest.php b/pkg/enqueue-bundle/Tests/Functional/RpcClientTest.php index ad4ea8787..1b60661a4 100644 --- a/pkg/enqueue-bundle/Tests/Functional/RpcClientTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/RpcClientTest.php @@ -11,7 +11,7 @@ class RpcClientTest extends WebTestCase { public function testTransportRpcClientCouldBeGetFromContainerAsService() { - $connection = $this->container->get(RpcClient::class); + $connection = static::$container->get(RpcClient::class); $this->assertInstanceOf(RpcClient::class, $connection); } diff --git a/pkg/enqueue-bundle/Tests/Functional/TopicRegistryTest.php b/pkg/enqueue-bundle/Tests/Functional/TopicRegistryTest.php index dc7ecfea5..bd15aa7d5 100644 --- a/pkg/enqueue-bundle/Tests/Functional/TopicRegistryTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/TopicRegistryTest.php @@ -11,7 +11,7 @@ class TopicRegistryTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $connection = $this->container->get(TopicMetaRegistry::class); + $connection = static::$container->get(TopicMetaRegistry::class); $this->assertInstanceOf(TopicMetaRegistry::class, $connection); } diff --git a/pkg/enqueue-bundle/Tests/Functional/TopicsCommandTest.php b/pkg/enqueue-bundle/Tests/Functional/TopicsCommandTest.php index c1bbf6229..f5c1595f1 100644 --- a/pkg/enqueue-bundle/Tests/Functional/TopicsCommandTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/TopicsCommandTest.php @@ -15,14 +15,14 @@ class TopicsCommandTest extends WebTestCase { public function testCouldBeGetFromContainerAsService() { - $command = $this->container->get(TopicsCommand::class); + $command = static::$container->get(TopicsCommand::class); $this->assertInstanceOf(TopicsCommand::class, $command); } public function testShouldDisplayRegisteredTopics() { - $command = $this->container->get(TopicsCommand::class); + $command = static::$container->get(TopicsCommand::class); $tester = new CommandTester($command); $tester->execute([]); @@ -43,7 +43,7 @@ public function testShouldDisplayRegisteredTopics() public function testShouldDisplayCommands() { - $command = $this->container->get(TopicsCommand::class); + $command = static::$container->get(TopicsCommand::class); $tester = new CommandTester($command); $tester->execute([]); diff --git a/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php b/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php index 5fc37c506..7e0bcfbde 100644 --- a/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/UseCasesTest.php @@ -279,8 +279,8 @@ public function testClientConsumeCommandMessagesFromExplicitlySetQueue(array $en { $this->customSetUp($enqueueConfig); - $command = $this->container->get(ConsumeMessagesCommand::class); - $processor = $this->container->get('test.message.command_processor'); + $command = static::$container->get(ConsumeMessagesCommand::class); + $processor = static::$container->get('test.message.command_processor'); $expectedBody = __METHOD__.time(); @@ -306,8 +306,8 @@ public function testClientConsumeMessagesFromExplicitlySetQueue(array $enqueueCo $expectedBody = __METHOD__.time(); - $command = $this->container->get(ConsumeMessagesCommand::class); - $processor = $this->container->get('test.message.processor'); + $command = static::$container->get(ConsumeMessagesCommand::class); + $processor = static::$container->get('test.message.processor'); $this->getMessageProducer()->sendEvent(TestProcessor::TOPIC, $expectedBody); @@ -337,9 +337,9 @@ public function testTransportConsumeMessagesCommandShouldConsumeMessage(array $e $expectedBody = __METHOD__.time(); - $command = $this->container->get(ContainerAwareConsumeMessagesCommand::class); - $command->setContainer($this->container); - $processor = $this->container->get('test.message.processor'); + $command = static::$container->get(ContainerAwareConsumeMessagesCommand::class); + $command->setContainer(static::$container); + $processor = static::$container->get('test.message.processor'); $this->getMessageProducer()->sendEvent(TestProcessor::TOPIC, $expectedBody); @@ -373,10 +373,10 @@ protected function customSetUp(array $enqueueConfig) $this->client = static::createClient(['enqueue_config' => $enqueueConfig]); $this->client->getKernel()->boot(); static::$kernel = $this->client->getKernel(); - $this->container = static::$kernel->getContainer(); + static::$container = static::$kernel->getContainer(); /** @var DriverInterface $driver */ - $driver = $this->container->get('enqueue.client.driver'); + $driver = static::$container->get('enqueue.client.driver'); $context = $this->getPsrContext(); $driver->setupBroker(); @@ -396,7 +396,7 @@ protected function customSetUp(array $enqueueConfig) protected function getTestQueue() { /** @var DriverInterface $driver */ - $driver = $this->container->get('enqueue.client.driver'); + $driver = static::$container->get('enqueue.client.driver'); return $driver->createQueue('test'); } @@ -419,7 +419,7 @@ protected static function createKernel(array $options = []) */ private function getMessageProducer() { - return $this->container->get(Producer::class); + return static::$container->get(Producer::class); } /** @@ -427,6 +427,6 @@ private function getMessageProducer() */ private function getPsrContext() { - return $this->container->get('enqueue.transport.context'); + return static::$container->get('enqueue.transport.context'); } } diff --git a/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php b/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php index 425123112..4b254ccd9 100644 --- a/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php +++ b/pkg/enqueue-bundle/Tests/Functional/WebTestCase.php @@ -17,7 +17,7 @@ abstract class WebTestCase extends BaseWebTestCase /** * @var ContainerInterface */ - protected $container; + protected static $container; protected function setUp() { @@ -26,7 +26,10 @@ protected function setUp() static::$class = null; $this->client = static::createClient(); - $this->container = static::$kernel->getContainer(); + + if (false == static::$container) { + static::$container = static::$kernel->getContainer(); + } } /** diff --git a/pkg/enqueue/.travis.yml b/pkg/enqueue/.travis.yml index 658dcabad..2c830d0a6 100644 --- a/pkg/enqueue/.travis.yml +++ b/pkg/enqueue/.travis.yml @@ -6,8 +6,13 @@ git: language: php php: - - '5.6' - - '7.0' + - '7.1' + +services: + - mongodb + +before_install: + - echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini cache: directories: diff --git a/pkg/enqueue/Consumption/QueueConsumer.php b/pkg/enqueue/Consumption/QueueConsumer.php index c41028b91..58209db8d 100644 --- a/pkg/enqueue/Consumption/QueueConsumer.php +++ b/pkg/enqueue/Consumption/QueueConsumer.php @@ -346,10 +346,18 @@ public function consume(ExtensionInterface $runtimeExtension = null) /** * @param bool $enableSubscriptionConsumer + * @throws \Enqueue\Consumption\Exception\InvalidArgumentException */ - public function enableSubscriptionConsumer(bool $enableSubscriptionConsumer) + public function enableSubscriptionConsumer($enableSubscriptionConsumer) { - $this->enableSubscriptionConsumer = $enableSubscriptionConsumer; + if (!is_bool($enableSubscriptionConsumer)) { + throw new InvalidArgumentException( + sprintf( + 'The argument must be a boolean but got %s.', + is_object($enableSubscriptionConsumer) ? get_class($enableSubscriptionConsumer) : gettype($enableSubscriptionConsumer) + ) + ); + } } /** diff --git a/pkg/mongodb/.travis.yml b/pkg/mongodb/.travis.yml new file mode 100644 index 000000000..6415d29e8 --- /dev/null +++ b/pkg/mongodb/.travis.yml @@ -0,0 +1,27 @@ +sudo: false + +language: php + +php: + - '7.1' + +git: + depth: 10 + +cache: + directories: + - $HOME/.composer/cache + +services: + - mongodb + +before_install: + - echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + +install: + - composer self-update + - composer install --prefer-source + +script: + - vendor/bin/phpunit --exclude-group=functional + diff --git a/pkg/mongodb/composer.json b/pkg/mongodb/composer.json index 59a2b6caa..9642adb77 100644 --- a/pkg/mongodb/composer.json +++ b/pkg/mongodb/composer.json @@ -17,6 +17,8 @@ }, "require-dev": { "phpunit/phpunit": "~5.4.0", + "symfony/dependency-injection": "^4", + "symfony/config": "^4", "queue-interop/queue-spec": "^0.5.5@dev", "enqueue/test": "^0.8.25@dev", "enqueue/enqueue": "^0.8@dev",