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
{{ message }}
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
When I call a static method on a mock object I get a warning from PHPUnit which does not tell me why.
Consider the following example:
class FooTest extends \PHPUnit_Framework_TestCase
{
public function testFoo()
{
$example = $this->createMock(ExampleClass::class);
$example->staticMethod();
$this->assertTrue(false);
}
}
class ExampleClass
{
public static function staticMethod()
{
}
}
The test results in a warning when the static method is called. The assertion afterwards is not executed, because the static method call produced an Exception.
I know, that PHPUnit does not mock static methods, but a reasonable error (or warning) message would be good. It took me some time to figure out the reason why my test triggered the warning (because the static call was not made directly in the test case but somewhere deep in the code).
The text was updated successfully, but these errors were encountered:
When I call a static method on a mock object I get a warning from PHPUnit which does not tell me why.
Consider the following example:
The test results in a warning when the static method is called. The assertion afterwards is not executed, because the static method call produced an Exception.
I know, that PHPUnit does not mock static methods, but a reasonable error (or warning) message would be good. It took me some time to figure out the reason why my test triggered the warning (because the static call was not made directly in the test case but somewhere deep in the code).
The text was updated successfully, but these errors were encountered: