如何在我的函数中模拟file_get_contents:-
let prod = Product(////////)
我尝试过:-
public function call()
{
$this->getData();
}
private function getData()
{
$filePath = $this->locator->locate(__DIR__ . '/../../fff/sss/file.json',
null, false);
$data = (array)json_decode(file_get_contents($filePath), true);
}
错误出现:-
$this->object->call()->shouldBeCalled();
如何在调用getData函数之前模拟此文件路径?