Skip to content

Commit

Permalink
Fixed test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoerr committed Jan 19, 2025
1 parent a1bced7 commit de902a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function setUp(): void

$this->productMetadataMock = $this->getMockBuilder(ProductMetadataInterface::class)
->disableOriginalConstructor()
->setMethods(['getName', 'getEdition', 'getVersion'])
->setMethods(['getName', 'getEdition', 'getVersion', 'getDistributionName', 'getDistributionVersion'])
->getMockForAbstractClass();

$this->rawResponseFactoryMock = $this->createPartialMock(RawFactory::class, ['create']);
Expand Down Expand Up @@ -78,9 +78,13 @@ public function testCommunityVersionDisplaysMajorMinorVersionAndEditionName(): v
$this->productMetadataMock->expects($this->any())->method('getVersion')->willReturn('2.3.3');
$this->productMetadataMock->expects($this->any())->method('getEdition')->willReturn('Community');
$this->productMetadataMock->expects($this->any())->method('getName')->willReturn('Magento');
$this->productMetadataMock->expects($this->any())->method('getDistributionVersion')
->willReturn('1.1.0');
$this->productMetadataMock->expects($this->any())->method('getDistributionName')
->willReturn('Mage-OS');

$this->rawResponseMock->expects($this->once())->method('setContents')
->with('Magento/2.3 (Community)')
->with('Mage-OS/1.1 (Community)')
->willReturnSelf();

$this->versionController->execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public function testIndexAction()
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var \Magento\Framework\App\ProductMetadataInterface $productMetadata */
$productMetadata = $objectManager->get(\Magento\Framework\App\ProductMetadataInterface::class);
$name = $productMetadata->getName();
$name = $productMetadata->getDistributionName();
$edition = $productMetadata->getEdition();

$fullVersion = $productMetadata->getVersion();
$fullVersion = $productMetadata->getDistributionVersion();
if ($this->isComposerBasedInstallation($fullVersion)) {
$versionParts = explode('.', $fullVersion);
$majorMinor = $versionParts[0] . '.' . $versionParts[1];
Expand Down

0 comments on commit de902a9

Please sign in to comment.