/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Version/Controller/Index/IndexTest.php
45 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ namespace Magento\Version\Controller\Index; class IndexTest extends \Magento\TestFramework\TestCase\AbstractController { public function testIndexAction() { // Execute controller to get version response $this->dispatch('magento_version/index/index'); $body = $this->getResponse()->getBody(); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Framework\App\ProductMetadataInterface $productMetadata */ $productMetadata = $objectManager->get(\Magento\Framework\App\ProductMetadataInterface::class); $name = $productMetadata->getName(); $edition = $productMetadata->getEdition(); $fullVersion = $productMetadata->getVersion(); if ($this->isComposerBasedInstallation($fullVersion)) { $versionParts = explode('.', $fullVersion); $majorMinor = $versionParts[0] . '.' . $versionParts[1]; // Response must contain Major.Minor version, product name, and edition $this->assertStringContainsString($majorMinor, $body); $this->assertStringContainsString($name, $body); $this->assertStringContainsString($edition, $body); // Response must not contain full version including patch version $this->assertStringNotContainsString($fullVersion, $body); } else { // Response is supposed to be empty when the project is installed from git $this->assertEmpty($body); } } private function isComposerBasedInstallation($fullVersion) { $versionParts = explode('-', $fullVersion); return !(isset($versionParts[0]) && $versionParts[0] == 'dev'); } }