0
我想测试一个从其他方法获取其数据的类方法。
所以我这样做:phpspec强制方法返回值
function it_should_return_json_file_as_array()
{
$this->exist()->willReturn(true);
$this->read()->willReturn("{\"key\":\"value\"}");
$this->getContent()->shouldHaveKeyWithValue('key', 'value');
}
但是,当我发起phpspec run
,我得到这个:
[InvalidArgumentException]
String "" is not a valid classname.
Please see reference document: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
这是怎么回事?
你也可以粘贴你正在尝试规范的方法吗? –
public function read() { \t return file_get_contents($ this-> path); } 公共职能的getContent(){ \t回json_decode($这个 - >阅读()); } –