Skip to content

Commit c10a1c5

Browse files
committed
int tests fix
1 parent 6d4e345 commit c10a1c5

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

app/code/Magento/MessageQueue/Test/Integration/PoisonPillAppyAfterCommandRunTest.php renamed to app/code/Magento/MessageQueue/Test/Integration/PoisonPillApplyAfterCommandRunTest.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface;
1111
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface;
12-
use Magento\Framework\Shell;
12+
use Magento\MessageQueue\Console\RestartConsumerCommand;
1313
use Magento\TestFramework\Helper\Bootstrap;
1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Console\Tester\CommandTester;
1516

16-
class PoisonPillAppyAfterCommandRunTest extends TestCase
17+
class PoisonPillApplyAfterCommandRunTest extends TestCase
1718
{
1819
/**
1920
* @var PoisonPillReadInterface
@@ -26,9 +27,9 @@ class PoisonPillAppyAfterCommandRunTest extends TestCase
2627
private $poisonPillCompare;
2728

2829
/**
29-
* @var Shell
30+
* @var RestartConsumerCommand
3031
*/
31-
private $shell;
32+
private $restartConsumerCommand;
3233

3334
/**
3435
* @inheritdoc
@@ -38,19 +39,27 @@ protected function setUp(): void
3839
$objectManager = Bootstrap::getObjectManager();
3940
$this->poisonPillRead = $objectManager->get(PoisonPillReadInterface::class);
4041
$this->poisonPillCompare = $objectManager->get(PoisonPillCompareInterface::class);
41-
$this->shell = $objectManager->get(Shell::class);
42+
$this->restartConsumerCommand = $objectManager->create(RestartConsumerCommand::class);
4243
}
4344

4445
/**
45-
* @throws \Magento\Framework\Exception\LocalizedException
4646
* @covers \Magento\MessageQueue\Setup\Recurring
4747
*
48-
* @magentoDbIsolation disabled
48+
* @magentoDbIsolation enabled
4949
*/
50-
public function testChangeVersion()
50+
public function testChangeVersion(): void
5151
{
5252
$version = $this->poisonPillRead->getLatestVersion();
53-
$this->shell->execute(PHP_BINARY . ' -f %s queue:consumers:restart', [BP . '/bin/magento']);
53+
$this->runTestRestartConsumerCommand();
5454
$this->assertEquals(false, $this->poisonPillCompare->isLatestVersion($version));
5555
}
56+
57+
/**
58+
* @return void
59+
*/
60+
private function runTestRestartConsumerCommand(): void
61+
{
62+
$commandTester = new CommandTester($this->restartConsumerCommand);
63+
$commandTester->execute([]);
64+
}
5665
}

0 commit comments

Comments
 (0)