尝试使用 phpdbg 运行感染测试时,我不断收到内存耗尽错误。我试过设置,-d memory_limit
但它似乎被忽略了。
下面是一些示例输出:
$ phpdbg -qrr -d memory_limit=1G vendor/bin/infection
You are running Infection with phpdbg enabled.
____ ____ __ _
/ _/___ / __/__ _____/ /_(_)___ ____
/ // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
_/ // / / / __/ __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/ \___/\___/\__/_/\____/_/ /_/
Running initial test suite...
PHPUnit version: 7.5.11
4 [============================] 1 sec
[ERROR] Project tests must be in a passing state before running Infection.
Infection runs the test suite in a RANDOM order. Make sure your tests do not have hidden dependencies.
You can add these attributes to `phpunit.xml` to check it: <phpunit executionOrder="random"
resolveDependencies="true" ...
If you don't want to let Infection run tests in a random order, set the `executionOrder` to some value, for
example <phpunit executionOrder="default"
Check the executed command to identify the problem: '/usr/local/Cellar/php@7.2/7.2.18/bin/phpdbg' '-qrr'
'~/Project/vendor/phpunit/phpunit/phpunit' '--configuration'
'/var/folders/05/qbcbz9cn08jdty7r35dwkgdm0000gn/T/infection/phpunitConfiguration.initial.infection.xml'
PHPUnit reported an exit code of 255.
Refer to the PHPUnit's output below:
STDOUT:
PHPUnit 7.5.11 by Sebastian Bergmann and contributors.
Random seed: 1560152243
[PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65536 bytes) in
~/Project/vendor/sebastian/exporter/src/Exporter.php on line
219]
[PHP Stack trace:]
[PHP 1. {main}()
~/Project/vendor/phpunit/phpunit/phpunit:0]
使用我的infection.json.dist 文件:
{
"timeout": 10,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "infection.log"
},
"mutators": {
"@default": true
}
}