我正在使用vim插件https://github.com/ludovicPelle/vim-xdebug和xdebug,与常规脚本相比,Xdebug和vim插件的使用没有问题。我可以逐步执行并打印变量。但是,在尝试逐步执行基本单元测试时,它可以顺利地到达断点并停止,我可以顺利地逐步执行代码,但无法再查看变量内容。 我正在尝试将其与一个非常基本的单元测试配合使用。
当我在方法的结尾处尝试打印出$a的内容时,我会得到以下错误提示。
当我打印整个上下文时,这3个变量显示如下:
class testClass extends \PHPUnit_Framework_TestCase
{
public function testSomething()
{
$a = 5;
$b = 6;
$c = 7;
}
}
当我在方法的结尾处尝试打印出$a的内容时,我会得到以下错误提示。
13 : send =====> property_get -i 13 -d 0 -n a
13 : recv <===== {{{ <?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="13" status="break" reason="ok"><error code="300"><message><![CDATA[can not get property]]></message></error></response>
}}}
response status=break xmlns=urn:debugger_protocol_v1 xmlns:xdebug=http://xdebug.org/dbgp/xdebug reason=ok command=property_get transaction_id=13
error code=300 : Can not get property (when the requested property to get did not exist, this is NOT used for an existing but uninitialized property, which just gets the type "uninitialised" (See: PreferredTypeNames)).
message
can not get property
当我打印整个上下文时,这3个变量显示如下:
$command = 'context_get';
a = /* uninitialized */'';
b = /* uninitialized */'';
c = /* uninitialized */'';
我知道phpunit在运行测试类的方法时会有一些有趣的技巧,这可能是为什么调试器没有返回方法中的变量的原因。如果有任何建议,将不胜感激,谢谢。
testClass::$a
,而不是$a
。 - Fabian Schmengler