phpunit
phpunit copied to clipboard
getMockForAbstractClass throws error
When using $this->getMockForAbstractClass() with PHPUnit 3.6RC2 I get following error: "Invalid argument supplied for foreach()". This was working correclty in PHPUnit 3.5
Please post the complete error message. Thanks.
Well it acctualy does not throw an error but shows the error as the tests fails.
There was 1 error:
- PC_DataGrid_Column_Renderer_AbstractTest::testSimple Invalid argument supplied for foreach()
/tests/library/PC/DataGrid/Column/Renderer/AbstractTest.php:10
_abstract = $this->getMockForAbstractClass('PC_DataGrid_Column_Renderer_Abstract'); } public function testSimple() { $this->assertEquals('foo', 'foo'); } ``` }
I cannot reproduce this issue:
sb@vmware ~ % cat AbstractTest.php
<?php
abstract class AbstractClass
{
public function foo()
{
return TRUE;
}
public abstract function bar();
}
class AbstractTest extends PHPUnit_Framework_TestCase
{
public function testFoo()
{
$o = $this->getMockForAbstractClass('AbstractClass');
}
}
sb@vmware ~ % phpunit AbstractTest
PHPUnit 3.6.0RC2 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 4.00Mb
OK (1 test, 0 assertions)
Now I see it, in my abstract class there is no abstract function :s