Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CircleCI中的codeception测试错误:PHP致命错误:允许的内存大小_Php_Phpunit_Yii2_Codeception_Circleci - Fatal编程技术网

CircleCI中的codeception测试错误:PHP致命错误:允许的内存大小

CircleCI中的codeception测试错误:PHP致命错误:允许的内存大小,php,phpunit,yii2,codeception,circleci,Php,Phpunit,Yii2,Codeception,Circleci,我有个问题。我在CircleCI中运行了自动测试,但测试结果失败。然后我用SSH进行调试。当我在终端中运行相同的测试命令时,结果是成功的 命令: $ cd tests; codecept run && cd - || exit 1 returned exit code 1 Time: 9.93 seconds, Memory: 32.75Mb OK (24 tests, 52 assertions) PHP Warning: Uncaught exception 'PHPU

我有个问题。我在CircleCI中运行了自动测试,但测试结果失败。然后我用SSH进行调试。当我在终端中运行相同的测试命令时,结果是成功的

命令:

$ cd tests; codecept run && cd - || exit 1 returned exit code 1
Time: 9.93 seconds, Memory: 32.75Mb

OK (24 tests, 52 assertions)
PHP Warning:  Uncaught exception 'PHPUnit_Framework_Exception' with message 'var_export does not handle circular references' in /home/ubuntu/.composer/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:49
Stack trace:
#0 [internal function]: Codeception\Subscriber\ErrorHandler->errorHandler(2, 'var_export does...', '/home/ubuntu/id...', 187, Array)
#1 /home/ubuntu/idarex/vendor/yiisoft/yii2/helpers/BaseVarDumper.php(187): var_export(Object(Pheanstalk\Exception\ConnectionException), true)
#2 /home/ubuntu/idarex/vendor/yiisoft/yii2/helpers/BaseVarDumper.php(147): yii\helpers\BaseVarDumper::exportInternal(Object(Pheanstalk\Exception\ConnectionException), 0)
#3 /home/ubuntu/idarex/vendor/yiisoft/yii2/log/Target.php(241): yii\helpers\BaseVarDumper::export(Object(Pheanstalk\Exception\ConnectionException))
#4 [internal function]: yii\log\Target->formatMessage(Array)
#5 /home/ubuntu/idarex/vendor/yiisoft/yii2/log/FileTarget.php(106): array_map(Array, Array)
#6 /home/ubuntu/idarex/vendor/yiisoft/yii2/log/Tar in /home/ubuntu/.composer/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php on line 49

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1046740958 bytes) in /home/ubuntu/idarex/vendor/yiisoft/yii2/helpers/BaseVarDumper.php on line 187 cd tests; codecept run && cd - || exit 1 returned exit code 1
自动测试结果:

$ cd tests; codecept run && cd - || exit 1 returned exit code 1
Time: 9.93 seconds, Memory: 32.75Mb

OK (24 tests, 52 assertions)
PHP Warning:  Uncaught exception 'PHPUnit_Framework_Exception' with message 'var_export does not handle circular references' in /home/ubuntu/.composer/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php:49
Stack trace:
#0 [internal function]: Codeception\Subscriber\ErrorHandler->errorHandler(2, 'var_export does...', '/home/ubuntu/id...', 187, Array)
#1 /home/ubuntu/idarex/vendor/yiisoft/yii2/helpers/BaseVarDumper.php(187): var_export(Object(Pheanstalk\Exception\ConnectionException), true)
#2 /home/ubuntu/idarex/vendor/yiisoft/yii2/helpers/BaseVarDumper.php(147): yii\helpers\BaseVarDumper::exportInternal(Object(Pheanstalk\Exception\ConnectionException), 0)
#3 /home/ubuntu/idarex/vendor/yiisoft/yii2/log/Target.php(241): yii\helpers\BaseVarDumper::export(Object(Pheanstalk\Exception\ConnectionException))
#4 [internal function]: yii\log\Target->formatMessage(Array)
#5 /home/ubuntu/idarex/vendor/yiisoft/yii2/log/FileTarget.php(106): array_map(Array, Array)
#6 /home/ubuntu/idarex/vendor/yiisoft/yii2/log/Tar in /home/ubuntu/.composer/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php on line 49

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1046740958 bytes) in /home/ubuntu/idarex/vendor/yiisoft/yii2/helpers/BaseVarDumper.php on line 187 cd tests; codecept run && cd - || exit 1 returned exit code 1
使用SSH结果进行调试:

Tests\codeception\mobile.unit Tests (0) -----
---------------------------------------------


[tests\codeception\mobile]: tests from /home/ubuntu/idarex/tests//codeception/mobile

Time: 7.22 seconds, Memory: 31.50Mb

OK (24 tests, 52 assertions)
我尝试在依赖项中设置内存限制

$ echo "memory_limit = 2048M" > ~/.phpenv/versions/$(phpenv global)/etc/conf.d/memory.ini

但是结果也失败了。

您知道大多数服务器的命令行都有单独的php.ini文件,对吗?没有说这是问题所在,但是,如果在命令行中工作,而不是在服务器上工作,那么可能需要考虑一些问题。。。嗯。。。这是一个存放所有ram的好地方。谢谢您的回复!自动测试也在CircleCI中使用命令行。您是否删除了var导出,您是否理解该错误的含义,它意味着var导出有一个循环引用,这有点像输出一个无限循环。这意味着您可能有一个类引用了第二个类,而第二个类引用了第一个类。它们相互引用,我认为var_dump可能比var_export做得更好。我不明白为什么var_export会出现codeception错误。我试着使用命令,
cd-tests;codecept--无交互--无颜色--无提示--快速失败--无ansi运行
。成功了!谢谢。你知道大多数服务器的命令行都有单独的php.ini文件,对吗?没有说这是问题所在,但是,如果在命令行中工作,而不是在服务器上工作,那么可能需要考虑一些问题。。。嗯。。。这是一个存放所有ram的好地方。谢谢您的回复!自动测试也在CircleCI中使用命令行。您是否删除了var导出,您是否理解该错误的含义,它意味着var导出有一个循环引用,这有点像输出一个无限循环。这意味着您可能有一个类引用了第二个类,而第二个类引用了第一个类。它们相互引用,我认为var_dump可能比var_export做得更好。我不明白为什么var_export会出现codeception错误。我试着使用命令,
cd-tests;codecept--无交互--无颜色--无提示--快速失败--无ansi运行
。成功了!非常感谢。