我有一个 extbase-extension (typo3 4.5)
$test = $this->testRepository->findAll();
$this->view->assign('test',
array_merge(
array('0' => 'select'),
$test->toArray()
)
);
它工作得很好,但我想测试代码并模拟我的 testrepository 的 findAll 方法。我不知道我必须返回哪种类型才能拥有 toArray 方法
...
$method->will($this->returnValue(array($testModelObject)));
...
当然,我的单元测试会引发错误:“在非对象上调用成员函数 toArray()”