public function __call($method, $args)
{
if ( ! in_array($method, $this->validMethods))
{
throw new \BadMethodCallException("Not a valid method: {$method}");
}
}
如何测试该__call
方法以确保$method
在我的有效方法列表中?现在这就是我所做的;
/**
* @covers World\Transmission::__call()
* @expectedException BadMethodCallException
* @expectedExceptionMessage Not a valid method: foo
*/
public function test__callInvalidRequest()
{
$m = m::mock('World\\Transmission', array($this->config))->makePartial();
$m->foo(array('foo'));
}
我得到的错误是call_user_func_array()
.
Maximum function nesting level of '100' reached, aborting!.
...