我想为 Symfony 4 贡献一些代码。因此我按照指南(https://symfony.com/doc/current/contributing/code/patches.html),分叉了 Symfony 并调用了测试。该指南说“PHP 5.5.9 或更高版本”,但是由于 PHP 7 新语法,测试失败。所以我切换到在 Windows 7 x64 上运行的 PHP 7.2。
在我接触任何代码之前运行时php ./phpunit symfony
,很多测试都失败了。大多数测试失败并显示“其他弃用通知”消息:
Testing src/Symfony/Component/Messenger
.............. 14 / 14 (100%)
Time: 3.66 seconds, Memory: 6.00MB
OK (14 tests, 25 assertions)
Other deprecation notices (1)
1x: The each() function is deprecated. This message will be suppressed on further calls
KO src/Symfony/Component/Messenger
最后它说,“好的但不完整,......”
Testing src/Symfony/Bundle/FrameworkBundle
............................................................. 61 / 1083 ( 5%)
............................................................. 122 / 1083 ( 11%)
............................................................. 183 / 1083 ( 16%)
............................................................. 244 / 1083 ( 22%)
............................................................. 305 / 1083 ( 28%)
............................................................. 366 / 1083 ( 33%)
............................................................. 427 / 1083 ( 39%)
.....................S....................................... 488 / 1083 ( 45%)
............................................................. 549 / 1083 ( 50%)
............................................................. 610 / 1083 ( 56%)
..................SS......................................... 671 / 1083 ( 61%)
............................................................. 732 / 1083 ( 67%)
............................................................. 793 / 1083 ( 73%)
............................................................. 854 / 1083 ( 78%)
............................................................. 915 / 1083 ( 84%)
............................................................. 976 / 1083 ( 90%)
............................................................. 1037 / 1083 ( 95%)
.............................................. 1083 / 1083 (100%)
Time: 3.94 minutes, Memory: 108.00MB
OK, but incomplete, skipped, or risky tests!
Tests: 1083, Assertions: 2282, Skipped: 3.
Legacy deprecation notices (14)
Other deprecation notices (1)
1x: The each() function is deprecated. This message will be suppressed on further calls
KO src/Symfony/Bundle/FrameworkBundle
还有“真正的”错误:
1) Symfony\Component\Security\Core\Tests\Encoder\Argon2iPasswordEncoderTest::testValidationWithConfig
password_hash(): Memory cost is outside of allowed memory range
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder.php:105
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder.php:67
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Security\Core\Tests\Encoder\Argon2iPasswordEncoderTest.php:34
或在这里:
1) Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testAskChoice
Symfony\Component\Console\Exception\RuntimeException: Aborted
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:118
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:67
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:369
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:70
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Console\Tests\Helper\QuestionHelperTest.php:89
或在这里:
1) Symfony\Component\VarDumper\Tests\Dumper\ServerDumperTest::testDump
Symfony\Component\Process\Exception\ProcessTimedOutException: The process "C:\Software\Development\Php7\php.exe" exceede
d the timeout of 9 seconds.
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Process\Process.php:1154
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\Process\Process.php:383
C:\Daten\Projekte\2018\dev\symfony\src\Symfony\Component\VarDumper\Tests\Dumper\ServerDumperTest.php:92