Description
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
- Windows 10
- PHP 5.6
- Out of the box Magento2 installation
Steps to reproduce
- php bin\magento dev:tests:run static
Expected result
- Tests pass
Actual result
I am provinding some example failures
-
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 -
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