警告:"Cannot find file '/3' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session."
warning: "Cannot find file '/3' locally. To fix it set server name by environment variable PHP_IDE_CONFIG and restart debug session."
每次我在使用调试进行单元测试时进入方法 (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 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()
.
调试器是实际上进入方法但是PhpStorm无法显示源代码,因为没有它的源代码。继续使用 "Step Into" 命令,在某些时候控件将返回到(PHPUnit 的)代码,其源代码是从文件加载的,PhpStorm 可以找到它。
刚遇到这个错误。在我的例子中,它是由缺少 private
关键字的方法引起的:
class SomeClass {
function some_function_name () {
}
}
应该看起来像:
class SomeClass {
private function some_function_name () {
}
}
每次我在使用调试进行单元测试时进入方法 (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 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()
.
调试器是实际上进入方法但是PhpStorm无法显示源代码,因为没有它的源代码。继续使用 "Step Into" 命令,在某些时候控件将返回到(PHPUnit 的)代码,其源代码是从文件加载的,PhpStorm 可以找到它。
刚遇到这个错误。在我的例子中,它是由缺少 private
关键字的方法引起的:
class SomeClass {
function some_function_name () {
}
}
应该看起来像:
class SomeClass {
private function some_function_name () {
}
}