每次我在使用调试进行单元测试时单步进入该方法 (prepareStatusFilterQuery()
) 时,我都会收到警告,并且调试器不会单步进入该方法。警告:
Cannot find file '/3' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session.
除此情况之外,调试器工作正常。
最佳答案
当您尝试单步执行模拟对象的代码时,就会发生这种情况。
没有解决方案,因为模拟对象是在测试执行期间创建的类的实例。
PHPUnit MockObjects 使用 reflection至gather information关于您要求它模拟的类(class)( the names 和 arguments of the public methods )然后它 generates新类(扩展模拟类)的 PHP 代码和 runs it using eval()
.
调试器实际上正在单步执行该方法,但 PhpStorm 无法显示源代码,因为没有源代码。继续使用“Step Into”命令,在某个时刻,控件将返回到(PHPUnit 的)代码,其源代码是从文件加载的,PhpStorm 可以找到它。
关于phpunit - 警告 : "Cannot find file '/3' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41163813/