PhpED has issues when
debugging (not running) some type of tests with PHPUnit.
For example mock of a class with multiple methods.
class MyClass
{
function root($x)
{
$base = $this->getRootBase();
$presision = $this->getConfig('presision');
$root = pow($x, 1/$base);
return round($root, $presision);
}
protected function getConfig($key)
{
$aConfig['presision'] = 2;
return $aConfig[$key];
}
protected function getRootBase()
{
return 3;
}
} |
We need a mock of MyClass with two methods:
class MyClassTest extends PHPUnit_Framework_TestCase
{
function testroot()
{
$mockMy = $this->getMock('\MyClass', array('getConfig', 'getRootBase'));
$mockMy->expects($this->any())
->method('getConfig')
->with('presision')
->will($this->returnValue(2));
$mockMy->expects($this->any())
->method('getRootBase')
->will($this->returnValue(2));
$this->assertEquals(2.83, $mockMy->root(8));
}
} |
When I try to debug a such test in PhpED I get an error message:
Project ... raised exception class PHPUnit_Framework_ComparisionFailure with message: "Failed asserting that strings are equal."
This happens only while debugging. Running such tests has no problem in PhpED.