Skip to content

Static tests in Windows fail due to file path mismatches #9805

Closed
@barbazul

Description

@barbazul

Current out of the box Magento2 does not pass static tests in Windows.

Most static integrity tests failures come from [path]\dev\tests\static\testsuite\Magento\Test\Integrity\ClassesTest.php, a file that is explicitely skipped in such tests only the skip mechanism fails under Windows due to paths not maching the exclusion condition

Preconditions

  1. Windows 10
  2. PHP 5.6
  3. Out of the box Magento2 installation

Steps to reproduce

  1. php bin\magento dev:tests:run static

Expected result

  1. Tests pass

Actual result

I am provinding some example failures

  1. Magento\Test\Integrity\ClassesTest::testClassReferences
    Passed: 16807, Failed: 1, Incomplete: 0, Skipped: 0.
    Data set: C:/magento2/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php
    Incorrect namespace usage(s) found in file C:/magento2/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php:
    Foo
    Exception
    C:\magento2\dev\tests\static\testsuite\Magento\Test\Integrity\ClassesTest.php:600
    C:\magento2\dev\tests\static\testsuite\Magento\Test\Integrity\ClassesTest.php:373
    C:\magento2\vendor\magento\framework\App\Utility\AggregateInvoker.php:56
    C:\magento2\dev\tests\static\testsuite\Magento\Test\Integrity\ClassesTest.php:376
    C:\magento2\vendor\magento\framework\App\Utility\AggregateInvoker.php:115
    C:\magento2\vendor\magento\framework\App\Utility\AggregateInvoker.php:70
    C:\magento2\dev\tests\static\testsuite\Magento\Test\Integrity\ClassesTest.php:376

  2. Magento\Test\Integrity\ClassesTest::testCoversAnnotation
    Nonexistent classes/methods were found in @Covers annotations:
    C:/magento2/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php: @Covers annotations
    C:\magento2\dev\tests\static\testsuite\Magento\Test\Integrity\ClassesTest.php:619

There are probably other cases.

In both cases I managed to make the tests pass by hacking the path being compared (like trimming the base path from the begining of the string or replacing \ with /).

I will try to work on a less hacky solution and provide a PR as soon as possible, but I thought reporting it might help someone like me struggling with the static tests in windows in the meantime

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for development

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions