Skip to content

Unit test fails after fresh installation #11230

@bnymn

Description

@bnymn

I have freshly installed Magento 2.2. The first thing I do is running unit tests. I have got one error.

Preconditions

  1. Magento 2.2
  2. PHP 7.0
  3. MySQL 5.7.19, for Linux (x86_64)

Steps to reproduce

  1. Install Magento with composer
  2. Run this command vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist
  3. You get the error

Expected result

  1. To pass all the unit tests

Actual result

  1. You got the following error:
Magento\Setup\Test\Unit\Module\Di\Code\Reader\FileClassScannerTest::testClassKeywordInMiddleOfFile
Magento\Setup\Module\Di\Code\Reader\InvalidFileException: The file "/var/www/html/magento2-install1" does not exist or is not a file

/var/www/html/magento2-install1/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php:39
/var/www/html/magento2-install1/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php:213

When I look at this file setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php, I am seeing the following test.

public function testClassKeywordInMiddleOfFile()
{
    $filename = __DIR__
        . '/../../../../../../../../../..'
        . '/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php';
    $filename = realpath($filename);
    $scanner = new FileClassScanner($filename);
    $result = $scanner->getClassNames();

    self::assertCount(1, $result);
}

This is interesting that there is not any file in app/code, since the file it is looking for inside vendor directory.

Metadata

Metadata

Labels

Fixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions