Closed robert-viana closed 9 months ago
Hm. From the logs it's clear that Xdebug connects to the IDE. Also the paths seem ok.
Init file: file:///home/dev/im/crm-api-php/src/vendor/bin/codecept
breakpoint file:///home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php
What I see is that the breakpoint never gets resolved and that tells me, the actual code execution never goes over that code path or even into that file (OpportunityService.php).
What happens if you put a xdebug_break()
on the same location as the breakpoint? Are you sure the code execution goes there - just put a die('here');
Thanks.
Hm. From the logs it's clear that Xdebug connects to the IDE. Also the paths seem ok. Init file:
file:///home/dev/im/crm-api-php/src/vendor/bin/codecept
breakpointfile:///home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php
What I see is that the breakpoint never gets resolved and that tells me, the actual code execution never goes over that code path or even into that file (OpportunityService.php).
What happens if you put a
xdebug_break()
on the same location as the breakpoint? Are you sure the code execution goes there - just put adie('here');
Thanks.
Hi @zobo, thanks for replying. I tried your suggestion and yes, the file "OpportunityService.php" is executed, as the die('here')
function work as expected, but xdebug_break()
does nothing.
[Request] POST http://api.crm.imlabs.local/v1/opportunities {"contact":{"name":"Test","phone_number":"123456789"},"name":"Test"}
[Page] http://api.crm.imlabs.local/v1/opportunities
[Response] 200
[Request Cookies] []
[Response Headers] {"Date":["Mon, 11 Sep 2023 12:21:54 GMT"],"Server":["Apache/2.4.41 (Ubuntu)"],"Expires":["Thu, 19 Nov 1981 08:52:00 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate"],"Pragma":["no-cache"],"Set-Cookie":["advanced-api=is3kbcl9v26aspa4demrmccp7c; path=/; HttpOnly"],"Vary":["Accept-Encoding"],"Transfer-Encoding":["chunked"],"Content-Type":["text/html; charset=UTF-8"]}
[Response] here
When i put xdebug_break()
on the codeception file, works well too.
<- stackTraceResponse
Response {
seq: 0,
type: 'response',
request_seq: 19,
command: 'stackTrace',
success: true,
body:
{ totalFrames: 21,
stackFrames:
[ { id: 21,
name: 'api\\tests\\OpportunityCest->testCreateSuccess',
source:
{ name: 'OpportunityCest.php',
path: '/home/dev/im/crm-api-php/src/api/tests/api/OpportunityCest.php' },
line: 216,
column: 1 },
{ id: 22,
name: 'ReflectionMethod->invokeArgs',
source:
{ name: 'Di.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Lib/Di.php' },
line: 130,
column: 1 },
{ id: 23,
name: 'Codeception\\Lib\\Di->injectDependencies',
source:
{ name: 'Di.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Lib/Di.php' },
line: 130,
column: 1 },
{ id: 24,
name: 'Codeception\\Test\\Cest->invoke',
source:
{ name: 'Cest.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Test/Cest.php' },
line: 184,
column: 1 },
{ id: 25,
name: 'Codeception\\Test\\Cest->executeTestMethod',
source:
{ name: 'Cest.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Test/Cest.php' },
line: 200,
column: 1 },
{ id: 26,
name: 'Codeception\\Test\\Cest->test',
source:
{ name: 'Cest.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Test/Cest.php' },
line: 129,
column: 1 },
{ id: 27,
name: 'Codeception\\Test\\Test->realRun',
source:
{ name: 'Test.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Test/Test.php' },
line: 168,
column: 1 },
{ id: 28,
name: 'Codeception\\Suite->run',
source:
{ name: 'Suite.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Suite.php' },
line: 130,
column: 1 },
{ id: 29,
name: 'Codeception\\SuiteManager->run',
source:
{ name: 'SuiteManager.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/SuiteManager.php' },
line: 148,
column: 1 },
{ id: 30,
name: 'Codeception\\Codecept->runSuite',
source:
{ name: 'Codecept.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Codecept.php' },
line: 260,
column: 1 },
{ id: 31,
name: 'Codeception\\Codecept->run',
source:
{ name: 'Codecept.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Codecept.php' },
line: 216,
column: 1 },
{ id: 32,
name: 'Codeception\\Command\\Run->execute',
source:
{ name: 'Run.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Command/Run.php' },
line: 435,
column: 1 },
{ id: 33,
name: 'Symfony\\Component\\Console\\Command\\Command->run',
source:
{ name: 'Command.php',
path: '/home/dev/im/crm-api-php/src/vendor/symfony/console/Command/Command.php' },
line: 326,
column: 1 },
{ id: 34,
name: 'Symfony\\Component\\Console\\Application->doRunCommand',
source:
{ name: 'Application.php',
path: '/home/dev/im/crm-api-php/src/vendor/symfony/console/Application.php' },
line: 1063,
column: 1 },
{ id: 35,
name: 'Symfony\\Component\\Console\\Application->doRun',
source:
{ name: 'Application.php',
path: '/home/dev/im/crm-api-php/src/vendor/symfony/console/Application.php' },
line: 320,
column: 1 },
{ id: 36,
name: 'Symfony\\Component\\Console\\Application->run',
source:
{ name: 'Application.php',
path: '/home/dev/im/crm-api-php/src/vendor/symfony/console/Application.php' },
line: 174,
column: 1 },
{ id: 37,
name: 'Codeception\\Application->run',
source:
{ name: 'Application.php',
path:
'/home/dev/im/crm-api-php/src/vendor/codeception/codeception/src/Codeception/Application.php' },
line: 112,
column: 1 },
{ id: 38,
name:
'{closure:/home/dev/im/crm-api-php/src/vendor/codeception/codeception/app.php:7-46}',
source:
{ name: 'app.php',
path: '/home/dev/im/crm-api-php/src/vendor/codeception/codeception/app.php' },
line: 45,
column: 1 },
{ id: 39,
name: 'require',
source:
{ name: 'app.php',
path: '/home/dev/im/crm-api-php/src/vendor/codeception/codeception/app.php' },
line: 46,
column: 1 },
{ id: 40,
name: 'include',
source:
{ name: 'codecept',
path: '/home/dev/im/crm-api-php/src/vendor/codeception/codeception/codecept' },
line: 7,
column: 1 } ] } }
Any more suggestions?
Can you attach the whole debug log? One with setting the break point in the IDE and one using xdebug_break()
? This usually boils down to some problem with path mappings, but I don't see what I need here.
With manual breakpoint on OpportunityService.php:199
:
[28055] Log opened at 2023-09-11 17:36:29.032483
[28055] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[28055] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[28055] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/dev/im/crm-api-php/src/vendor/bin/codecept" language="PHP" xdebug:language_version="8.1.23" protocol_version="1.0" appid="28055" idekey="VSCODE"><engine version="3.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>
[28055] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
[28055] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
[28055] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
[28055] [Step Debug] <- feature_set -i 4 -n breakpoint_include_return_value -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="breakpoint_include_return_value" success="1"></response>
[28055] [Step Debug] <- feature_set -i 5 -n max_children -v 100
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="max_children" success="1"></response>
[28055] [Step Debug] <- breakpoint_set -i 6 -t line -f file:///home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php -n 199
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="280550001" resolved="unresolved"></response>
[28055] [Step Debug] <- run -i 7
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="7" status="stopping" reason="ok"></response>
[28055] [Step Debug] <- stop -i 8
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="8" status="stopped" reason="ok"></response>
[28055] Log closed at 2023-09-11 17:36:29.592207
With function xdebug_break()
on OpportuntyService.php:199
:
[28055] Log opened at 2023-09-11 17:36:29.032483
[28055] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[28055] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[28055] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/dev/im/crm-api-php/src/vendor/bin/codecept" language="PHP" xdebug:language_version="8.1.23" protocol_version="1.0" appid="28055" idekey="VSCODE"><engine version="3.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>
[28055] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
[28055] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
[28055] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
[28055] [Step Debug] <- feature_set -i 4 -n breakpoint_include_return_value -v 1
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="breakpoint_include_return_value" success="1"></response>
[28055] [Step Debug] <- feature_set -i 5 -n max_children -v 100
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="max_children" success="1"></response>
[28055] [Step Debug] <- breakpoint_set -i 6 -t line -f file:///home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php -n 199
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="280550001" resolved="unresolved"></response>
[28055] [Step Debug] <- run -i 7
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="7" status="stopping" reason="ok"></response>
[28055] [Step Debug] <- stop -i 8
[28055] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="8" status="stopped" reason="ok"></response>
[28055] Log closed at 2023-09-11 17:36:29.592207
[28318] Log opened at 2023-09-11 17:37:50.753789
[28318] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[28318] [Step Debug] INFO: Connected to debugging client: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[28318] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/dev/im/crm-api-php/src/vendor/bin/codecept" language="PHP" xdebug:language_version="8.1.23" protocol_version="1.0" appid="28318" idekey="VSCODE"><engine version="3.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>
[28318] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
[28318] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
[28318] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
[28318] [Step Debug] <- feature_set -i 4 -n breakpoint_include_return_value -v 1
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="breakpoint_include_return_value" success="1"></response>
[28318] [Step Debug] <- feature_set -i 5 -n max_children -v 100
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="max_children" success="1"></response>
[28318] [Step Debug] <- run -i 6
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="6" status="stopping" reason="ok"></response>
[28318] [Step Debug] <- stop -i 7
[28318] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="7" status="stopped" reason="ok"></response>
[28318] Log closed at 2023-09-11 17:37:51.283389
Sorry I wasn't clear enough, I wanted the logs from VS Code, not xdebug.log as that gives more more information.
However, even from these two logs I can see neither session actually breaks.
The DBGP commad run
is follower by a response of status="stopping"
which tells me the script has finished executing. Had there been a breakpoint the status
would have been break
.
I did notice something else. The breakpoint is set on /home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php
whereas the stack trace you have is in /home/dev/im/crm-api-php/src/api/tests/api/OpportunityCest.php
Notice modules/v1 instead of tests/api
...
Sorry I wasn't clear enough, I wanted the logs from VS Code, not xdebug.log as that gives more more information.
Sure, here they are:
Listening on { address: '::', family: 'IPv6', port: 9003 }
<- launchResponse
Response { seq: 0, type: 'response', request_seq: 2, command: 'launch', success: true }
<- initializedEvent
InitializedEvent { seq: 0, type: 'event', event: 'initialized' }
-> setFunctionBreakpointsRequest
{ command: 'setFunctionBreakpoints',
arguments: { breakpoints: [] },
type: 'request',
seq: 3 }
<- setFunctionBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 3,
command: 'setFunctionBreakpoints',
success: true,
body: { breakpoints: [] } }
-> setExceptionBreakpointsRequest
{ command: 'setExceptionBreakpoints',
arguments: { filters: [] },
type: 'request',
seq: 4 }
<- setExceptionBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 4,
command: 'setExceptionBreakpoints',
success: true,
body: { breakpoints: [] } }
-> configurationDoneRequest
{ command: 'configurationDone', type: 'request', seq: 5 }
<- configurationDoneResponse
Response {
seq: 0,
type: 'response',
request_seq: 5,
command: 'configurationDone',
success: true }
-> threadsRequest
{ command: 'threads', type: 'request', seq: 6 }
<- threadsResponse
Response {
seq: 0,
type: 'response',
request_seq: 6,
command: 'threads',
success: true,
body: { threads: [] } }
-> setBreakpointsRequest
{ command: 'setBreakpoints',
arguments:
{ source:
{ name: 'OpportunityService.php',
path: '/home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php' },
lines: [ 200 ],
breakpoints: [ { line: 200 } ],
sourceModified: false },
type: 'request',
seq: 7 }
<- setBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 7,
command: 'setBreakpoints',
success: true,
body:
{ breakpoints:
[ { verified: true,
line: 200,
source:
{ name: 'OpportunityService.php',
path: '/home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php' },
id: 1 } ] } }
new connection 1 from ::ffff:127.0.0.1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/dev/im/crm-api-php/src/vendor/bin/codecept" language="PHP" xdebug:language_version="8.1.23" protocol_version="1.0" appid="6814" idekey="VSCODE"><engine version="3.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>
xd(1) <- feature_set -i 1 -n resolved_breakpoints -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
xd(1) <- feature_set -i 2 -n notify_ok -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
xd(1) <- feature_set -i 3 -n extended_properties -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
xd(1) <- feature_set -i 4 -n breakpoint_include_return_value -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="breakpoint_include_return_value" success="1"></response>
xd(1) <- feature_set -i 5 -n max_children -v 100
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="max_children" success="1"></response>
<- threadEvent
ThreadEvent { seq: 0, type: 'event', event: 'thread', body: { reason: 'started', threadId: 1 } }
xd(1) <- breakpoint_set -i 6 -t line -f file:///home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php -n 200
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6" id="68140001" resolved="unresolved"></response>
<- breakpointEvent
BreakpointEvent {
seq: 0,
type: 'event',
event: 'breakpoint',
body: { reason: 'changed', breakpoint: { id: 1, verified: false } } }
xd(1) <- run -i 7
-> threadsRequest
{ command: 'threads', type: 'request', seq: 8 }
<- threadsResponse
Response {
seq: 0,
type: 'response',
request_seq: 8,
command: 'threads',
success: true,
body: { threads: [ Thread { id: 1, name: 'Request 1 (3:36:37 PM)' } ] } }
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="7" status="stopping" reason="ok"></response>
xd(1) <- stop -i 8
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="8" status="stopped" reason="ok"></response>
<- threadEvent
ThreadEvent { seq: 0, type: 'event', event: 'thread', body: { reason: 'exited', threadId: 1 } }
I did notice something else. The breakpoint is set on
/home/dev/im/crm-api-php/src/api/modules/v1/services/OpportunityService.php
whereas the stack trace you have is in/home/dev/im/crm-api-php/src/api/tests/api/OpportunityCest.php
Notice modules/v1 instead of
tests/api
...
Yes, my API tests are on dir /src/api/tests/api
and the API files are on /src/api/modules/v1/services/
. In other words, i can debug what is in the /api/tests/...
dir, but not what is in the API /api/modules/...
for some reason. I'm missing something in the configuration file?
To make it clear, yes i can debug from CLI, like running a script, but not by Codeception tests. That happened in my migration of php7.4 to php8.1 :(
Sorry for not replying last night, it got late here. I'll need to setup the whole thing here. I'm guessing that Codeception spawns a PHP sub process. The die
from before could be a clue as it is printed out as [Response] here
. You can retry this case by adding a xdebug_info()
instead of or just before the die
call to see what state Xdebug is in and if it is indeed a separate PHP process. If that function call does not work, try it with phpinfo()
to see if Xdebug is even loaded in that other PHP process.
Must say, this is an unusual issue.
Sorry for the delay. I reviewed all the Codeception configs as I thought the bug as there. And it payoff!!!
Changing the api.suite.yml
from:
actor: ApiTester
modules:
enabled:
- Asserts
- \api\tests\Helper\Api
- REST:
depends: PhpBrowser
url: http://api.crm.imlabs.local/v1/
config:
- Yii2
to:
actor: ApiTester
modules:
enabled:
- Asserts
- \api\tests\Helper\Api
- REST:
url: /v1
depends: Yii2
config:
- Yii2
Solved my issue in debugging tests. Thanks for all the effort and suggestions @zobo
PHP version: 8.1.23 Xdebug version: 3.2.2 VS Code extension version: 1.33.0
Your launch.json:
Xdebug php.ini config:
Xdebug logfile (from setting
xdebug.log
in php.ini):VS Code extension logfile (from setting
"log": true
in launch.json):Steps to Reproduce:
So i have this problem for running my Codeception api tests after i update my PHP7.4 to PHP8.1 (before was working fine). Breakpoint work fine in the test file, but never reach on my application files (they execute, but breakpoint don't work). Any thoughts about it?
Additional info:
Test example: