php prophecy文件名不能为空

时间:2018-11-27 10:09:25

标签: php testcase phpunit-testing prophecy

如何在我的函数中模拟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函数之前模拟此文件路径?

0 个答案:

没有答案