Фатальная ошибка PHPUnit и Magento Bootstrap: Uncaught CredisException - PullRequest
0 голосов
/ 18 октября 2018

У меня проблема с Magento 1.9 и PHPUNit 7.4 .Версия PHP 7.2 .

Под деревом.http - это папка Magento.

root/
├── http/
│   └── app
├── php-unit -> (with composer)
├── test/
│   └── unit/
│       ├── bootstrap.php
│       └── testsuite/
│           └── module
└── phpunit.xml

Ниже исходного файла XML.

<!-- phpunit.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/|version|/phpunit.xsd"
    backupStaticAttributes="false"
    bootstrap="tests/unit/bootstrap.php"
    cacheTokens="true"
    backupGlobals="true"
    forceCoversAnnotation="false"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    stopOnError="false"
    stopOnIncomplete="false"
    stopOnSkipped="false"
    stopOnRisky="false"
    stopOnFailure="false"
    testSuiteLoaderClass="PHPUnit\Runner\StandardTestSuiteLoader"
    timeoutForSmallTests="1"
    timeoutForMediumTests="10"
    timeoutForLargeTests="60"
    colors="true"
    verbose="true">
    <testsuites>
        <testsuite name="Test Suite">
            <directory>tests/unit/testsuite/</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">http/app/code/local/</directory>
            <exclude>
                <file>http/app/Mage.php</file>
                <directory suffix=".php">http/app/code/core</directory>
                <directory suffix=".php">http/app/code/local/Credis</directory>
                <directory suffix=".phtml">http/app/design</directory>
                <directory suffix=".php">http/lib/Varien</directory>
                <directory suffix=".php">http/lib/Zend</directory>
                <directory suffix=".php">http/lib/Magento</directory>
            </exclude>
        </whitelist>
    </filter>
</phpunit>

Ниже bootstrap.php.

//bootstrap.php
class Bootstrap {
    public function __construct() {
        echo "Loading Magento\n";

        # ABSOLUTE PATH SERVER
        require_once( getcwd().'/http/app/Mage.php' );
        echo "require_once Mage\n";

        Mage::app(); <--- Error
        echo "start Mage::app()\n";

Ошибкасообщение, наконец:

PHP Fatal error:  Uncaught CredisException: Connection to Redis redis:6379 failed after 2 failures.
Last Error : (0) php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /myfolder/http/app/code/local/Credis/Client.php:475
...