Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: "Cannot find file '/3' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session."

Every time I step into the method (prepareStatusFilterQuery()) while unit testing with debug I got warning and debugger not stepping into the method. Warning:

Cannot find file '/3' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session.

Other than this case debugger works fine.

enter image description here

like image 877
user6827096 Avatar asked Dec 10 '22 13:12

user6827096


1 Answers

This happens when you try to step into the code of a mock object.

There is no solution for it because the mock objects are instances of classes that are created during the execution of the test.

PHPUnit MockObjects uses reflection to gather information about the class you ask it to mock (the names and arguments of the public methods) then it generates the PHP code of a new class (that extends the mocked class) and runs it using eval().

The debugger is actually stepping into the method but PhpStorm cannot display the source code because there is no source code for it. Keep using the "Step Into" command and at some point the control will go back to code (of PHPUnit) whose source code is loaded from a file and PhpStorm can find it.

like image 64
axiac Avatar answered Jan 04 '23 23:01

axiac