|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +declare(strict_types=1); |
| 7 | + |
| 8 | +namespace Magento\MessageQueue\Test\Integration; |
| 9 | + |
| 10 | +use Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface; |
| 11 | +use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface; |
| 12 | +use Magento\Framework\Shell; |
| 13 | +use Magento\TestFramework\Helper\Bootstrap; |
| 14 | +use PHPUnit\Framework\TestCase; |
| 15 | + |
| 16 | +class PoisonPillApplyDuringSetupUpgradeTest extends TestCase |
| 17 | +{ |
| 18 | + /** |
| 19 | + * @var PoisonPillReadInterface |
| 20 | + */ |
| 21 | + private $poisonPillRead; |
| 22 | + |
| 23 | + /** |
| 24 | + * @var PoisonPillCompareInterface |
| 25 | + */ |
| 26 | + private $poisonPillCompare; |
| 27 | + |
| 28 | + /** |
| 29 | + * @var Shell |
| 30 | + */ |
| 31 | + private $shell; |
| 32 | + |
| 33 | + /** |
| 34 | + * @inheritdoc |
| 35 | + */ |
| 36 | + protected function setUp(): void |
| 37 | + { |
| 38 | + $objectManager = Bootstrap::getObjectManager(); |
| 39 | + $this->poisonPillRead = $objectManager->get(PoisonPillReadInterface::class); |
| 40 | + $this->poisonPillCompare = $objectManager->get(PoisonPillCompareInterface::class); |
| 41 | + $this->shell = $objectManager->get(Shell::class); |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * @throws \Magento\Framework\Exception\LocalizedException |
| 46 | + * @covers \Magento\MessageQueue\Setup\Recurring |
| 47 | + * |
| 48 | + * @magentoDbIsolation disabled |
| 49 | + */ |
| 50 | + public function testChangeVersion() |
| 51 | + { |
| 52 | + $version = $this->poisonPillRead->getLatestVersion(); |
| 53 | + $this->shell->execute(PHP_BINARY . ' -f %s setup:upgrade --keep-generated', [BP . '/bin/magento']); |
| 54 | + $this->assertEquals(false, $this->poisonPillCompare->isLatestVersion($version)); |
| 55 | + } |
| 56 | +} |
0 commit comments