Skip to content

Commit

Permalink
magento#23540: Queue consumers.
Browse files Browse the repository at this point in the history
Test refactoring.
  • Loading branch information
swnsma committed Feb 7, 2021
1 parent e4e9935 commit 9f3acae
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

use Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface;
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface;
use Magento\Framework\Shell;
use Magento\Setup\Console\Command\UpgradeCommand;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Tester\CommandTester;

class PoisonPillApplyDuringSetupUpgradeTest extends TestCase
{
Expand All @@ -26,9 +27,9 @@ class PoisonPillApplyDuringSetupUpgradeTest extends TestCase
private $poisonPillCompare;

/**
* @var Shell
* @var UpgradeCommand
*/
private $shell;
private $upgradeCommand;

/**
* @inheritdoc
Expand All @@ -38,19 +39,27 @@ protected function setUp(): void
$objectManager = Bootstrap::getObjectManager();
$this->poisonPillRead = $objectManager->get(PoisonPillReadInterface::class);
$this->poisonPillCompare = $objectManager->get(PoisonPillCompareInterface::class);
$this->shell = $objectManager->get(Shell::class);
$this->upgradeCommand = $objectManager->get(UpgradeCommand::class);
}

/**
* @throws \Magento\Framework\Exception\LocalizedException
* @covers \Magento\MessageQueue\Setup\Recurring
*
* @magentoDbIsolation disabled
*/
public function testChangeVersion()
{
$version = $this->poisonPillRead->getLatestVersion();
$this->shell->execute(PHP_BINARY . ' -f %s setup:upgrade --keep-generated', [BP . '/bin/magento']);
$this->runTestUpgradeCommand();
$this->assertEquals(false, $this->poisonPillCompare->isLatestVersion($version));
}

/**
* @return void
*/
private function runTestUpgradeCommand(): void
{
$commandTester = new CommandTester($this->upgradeCommand);
$commandTester->execute(['--keep-generated']);
}
}

0 comments on commit 9f3acae

Please sign in to comment.