我上课了:
class Subscribe
{
public static function isSubscribe($email)
{
return true;
}
}
我的测试:
public static function testIsSubscribe()
{
$subscribe = new \Model\Subscribe();
$object = Stub::make($subscribe, ['isSubscribe' => 'isSubscribe']);
$this->assertEquals('isSubscribe', $object->isSubscribe(['email' => 'email@gmail.com']));
}
但是,测试静态类testIsSubscribe()
会给我异常
PHPUnit_Framework_MockObject_BadMethodCallException:
答案 0 :(得分:2)
静态方法未经过测试,应避免编写