在 Codeception 堆栈跟踪中显示超过 10 个调用

Show more than 10 calls in Codeception stack trace

我正在通过 Codeception 调试一些递归代码,它只显示最后 10 个调用,所以我不知道代码的路径是什么。 Xdebug 设置为显示尽可能多的信息,所以我不认为是这样。

我还没有找到任何配置选项来增加 Codeception 输出中显示的堆栈跟踪级别的数量。

如何增加 Codeception 输出中的调用次数?

截断的错误消息:

There was 1 error:

---------
1) Hl7MessageHeaderSegmentWriterTest: Should build a message header segment
 Test  tests\unit\HMRX\CoreBundle\Utils\Hl7Writer\Segment\Hl7MessageHeaderSegmentWriterTest.php:testShouldBuildAMessageHeaderSegment

  [PHPUnit_Framework_Exception] Object of class DateTimeImmutable could not be converted to string

#1  Codeception\Subscriber\ErrorHandler->errorHandler
#2  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:283
#3  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:251
#4  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7SimpleElementWriter.php:49
#5  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:54
#6  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:29
#7  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:54
#8  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:29
#9  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7ElementFormatter.php:54
#10 C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Segment\Hl7HeaderSegmentWriter.php:18

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

正常错误消息(注意最后一行是codecept.phar的入口点):

There was 1 error:

---------
1) Hl7MessageHeaderSegmentWriterTest: Should build a message header segment
 Test  tests\unit\HMRX\CoreBundle\Utils\Hl7Writer\Segment\Hl7MessageHeaderSegmentWriterTest.php:testShouldBuildAMessageHeaderSegment

  [Exception] foo

#1  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Data\Hl7DateTimeWrapperDataWriter.php:45
#2  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Data\Hl7TimeStampDataWriter.php:54
#3  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7DataForwarder.php:30
#4  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7DataForwarder.php:24
#5  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7DataForwarder.php:20
#6  C:\server\Apache24\htdocs\dev.hmr-app\hmrex\HMRX_App\src\HMRX\CoreBundle\Utils\Hl7Writer\Hl7DataForwarder.php:13
#7  C:\server\Apache24\htdocs\dev.hmr-app\tests\unit\HMRX\CoreBundle\Utils\Hl7Writer\Segment\Hl7MessageHeaderSegmentWriterTest.php:53
#8  HMRX\CoreBundle\Utils\Hl7Writer\Hl7MessageHeaderSegmentWriterTest->testShouldBuildAMessageHeaderSegment
#9  C:\usr\bin\codecept.phar:7

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

来自 phpinfo() 的 Xdebug 配置:

xdebug

xdebug support => enabled
Version => 2.5.5

Supported protocols => Revision
DBGp - Common DeBuGger Protocol => $Revision: 1.145 $

Directive => Local Value => Master Value
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.coverage_enable => On => On
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.extended_info => On => On
xdebug.file_link_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_enable_trigger_value => no value => no value
xdebug.profiler_output_dir => \ => \
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_addr_header => no value => no value
xdebug.remote_autostart => Off => Off
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.scream => Off => Off
xdebug.show_error_trace => Off => Off
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_enable_trigger => Off => Off
xdebug.trace_enable_trigger_value => no value => no value
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => \ => \
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => -1 => -1
xdebug.var_display_max_data => -1 => -1
xdebug.var_display_max_depth => -1 => -1

运行 使用 -vvv 标志进行代码接收以获得完整的堆栈跟踪。

数字 $limit = 10 硬编码在 \Codeception\Subscriber\Console::printExceptionTrace

您可以暂时将该数字编辑得稍高一些。

$this->rawStackTrace 是从 -vvv Symfony 控制台参数设置的代码接收标志,它绕过有限的渲染循环,只转储原始堆栈跟踪。

它们都跳过了 \PHPUnit\Util\Filter::$filteredClassesPattern 中定义的过滤 类,因此您可以向该数组添加更多 类 以删除应用程序内容(如果这就是您的意思phar 调用,我没有使用 phar,我是通过更易于编辑的 composer 使用它。