From be0bf0d1f842df4e9cc9ab6ba0688aa04f068cf4 Mon Sep 17 00:00:00 2001 From: Sergii Dolgushev Date: Mon, 13 Nov 2023 19:19:51 +0000 Subject: [PATCH 1/2] [Messenger] pcntl PHP extension is required since v6.3.5 --- src/Symfony/Component/Messenger/composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/Messenger/composer.json b/src/Symfony/Component/Messenger/composer.json index 7bbb47c4d26bf..1c97b37785af5 100644 --- a/src/Symfony/Component/Messenger/composer.json +++ b/src/Symfony/Component/Messenger/composer.json @@ -17,6 +17,7 @@ ], "require": { "php": ">=8.1", + "ext-pcntl": "*", "psr/log": "^1|^2|^3", "symfony/clock": "^6.3", "symfony/deprecation-contracts": "^2.5|^3" From 1b15ce977f5804d6041e61649992d22a0eba98b4 Mon Sep 17 00:00:00 2001 From: Sergii Dolgushev Date: Mon, 13 Nov 2023 20:29:57 +0000 Subject: [PATCH 2/2] [Messenger] Added test to demonstrate that pcntl is required --- .../Command/ConsumeMessagesCommandTest.php | 58 +++++++++++++------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php index 0173052290047..eeca548fa3599 100644 --- a/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php +++ b/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php @@ -14,6 +14,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Exception\InvalidOptionException; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Helper\HelperSet; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Tester\CommandCompletionTester; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -42,23 +46,7 @@ public function testConfigurationWithDefaultReceiver() public function testBasicRun() { - $envelope = new Envelope(new \stdClass(), [new BusNameStamp('dummy-bus')]); - - $receiver = $this->createMock(ReceiverInterface::class); - $receiver->expects($this->once())->method('get')->willReturn([$envelope]); - - $receiverLocator = $this->createMock(ContainerInterface::class); - $receiverLocator->expects($this->once())->method('has')->with('dummy-receiver')->willReturn(true); - $receiverLocator->expects($this->once())->method('get')->with('dummy-receiver')->willReturn($receiver); - - $bus = $this->createMock(MessageBusInterface::class); - $bus->expects($this->once())->method('dispatch'); - - $busLocator = $this->createMock(ContainerInterface::class); - $busLocator->expects($this->once())->method('has')->with('dummy-bus')->willReturn(true); - $busLocator->expects($this->once())->method('get')->with('dummy-bus')->willReturn($bus); - - $command = new ConsumeMessagesCommand(new RoutableMessageBus($busLocator), $receiverLocator, new EventDispatcher()); + $command = $this->getConsumeMessagesCommand(); $application = new Application(); $application->add($command); @@ -72,6 +60,21 @@ public function testBasicRun() $this->assertStringContainsString('[OK] Consuming messages from transport "dummy-receiver"', $tester->getDisplay()); } + public function testBasicApplicationRun() + { + $command = $this->getConsumeMessagesCommand(); + $command->setHelperSet(new HelperSet()); + + $application = new Application(); + $doRunCommand = (new \ReflectionClass($application))->getMethod('doRunCommand'); + + $input = new ArrayInput([ + 'receivers' => ['dummy-receiver'], + '--limit' => 1, + ]); + $doRunCommand->invokeArgs($application, [$command, $input, new ConsoleOutput()]); + } + public function testRunWithBusOption() { $envelope = new Envelope(new \stdClass()); @@ -234,4 +237,25 @@ public static function provideCompletionSuggestions() yield 'receiver (no repeat)' => [['async', ''], ['async_high', 'failed']]; yield 'option --bus' => [['--bus', ''], ['messenger.bus.default']]; } + + private function getConsumeMessagesCommand(): ConsumeMessagesCommand + { + $envelope = new Envelope(new \stdClass(), [new BusNameStamp('dummy-bus')]); + + $receiver = $this->createMock(ReceiverInterface::class); + $receiver->expects($this->once())->method('get')->willReturn([$envelope]); + + $receiverLocator = $this->createMock(ContainerInterface::class); + $receiverLocator->expects($this->once())->method('has')->with('dummy-receiver')->willReturn(true); + $receiverLocator->expects($this->once())->method('get')->with('dummy-receiver')->willReturn($receiver); + + $bus = $this->createMock(MessageBusInterface::class); + $bus->expects($this->once())->method('dispatch'); + + $busLocator = $this->createMock(ContainerInterface::class); + $busLocator->expects($this->once())->method('has')->with('dummy-bus')->willReturn(true); + $busLocator->expects($this->once())->method('get')->with('dummy-bus')->willReturn($bus); + + return new ConsumeMessagesCommand(new RoutableMessageBus($busLocator), $receiverLocator, new EventDispatcher()); + } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy