You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version : PHPUnit 3.5
Platform : PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)
I appreciate that an abstract class with no abstract methods may seem a little odd, we have such classes that we want to test through PHPUnit. This unit tests demonstrates what I mean.
<?php
abstract class HasAbstractMethod {
function foo() {}
abstract function bar();
}
abstract class HasNoAbstractMethods {
function foo() {}
}
class BugReport_getMockForAbstractClass_NoAbstractMethods extends PHPUnit_Framework_TestCase {
public function testCanUseGetMockForAbstractClassWhenClassHasAbstractMethods() {
$c = $this->getMockForAbstractClass('HasAbstractMethod');
}
public function testCanUseGetMockForAbstractClassWhenClassHasNoAbstractMethods() {
$c = $this->getMockForAbstractClass('HasNoAbstractMethods');
// this test fails:
//Argument 2 passed to PHPUnit_Framework_MockObject_Generator::generateMock() must be an array, null given, called in /usr/share/php/PHPUnit/Framework/MockObject/Generator.php on line 283
}
}
Would be a fairly straightforward mix - just to pass in a blank array rather than null in Generator.php:
Version : PHPUnit 3.5
Platform : PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)
I appreciate that an abstract class with no abstract methods may seem a little odd, we have such classes that we want to test through PHPUnit. This unit tests demonstrates what I mean.
Would be a fairly straightforward mix - just to pass in a blank array rather than null in Generator.php:
The text was updated successfully, but these errors were encountered: