Skip to content

Commit 9f3acae

Browse files
committed
#23540: Queue consumers.
Test refactoring.
1 parent e4e9935 commit 9f3acae

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

app/code/Magento/MessageQueue/Test/Integration/PoisonPillApplyDuringSetupUpgradeTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

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

1617
class PoisonPillApplyDuringSetupUpgradeTest extends TestCase
1718
{
@@ -26,9 +27,9 @@ class PoisonPillApplyDuringSetupUpgradeTest extends TestCase
2627
private $poisonPillCompare;
2728

2829
/**
29-
* @var Shell
30+
* @var UpgradeCommand
3031
*/
31-
private $shell;
32+
private $upgradeCommand;
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->upgradeCommand = $objectManager->get(UpgradeCommand::class);
4243
}
4344

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

0 commit comments

Comments
 (0)