0

I have an extbase-extension (typo3 4.5) with

$test = $this->testRepository->findAll();
$this->view->assign('test', 
    array_merge(
        array('0' => 'select'), 
        $test->toArray()
    )
);

it works very well, but i want to test the code and mock the findAll-method of my testrepository. I dont know which type i must return to have the toArray-method

...
$method->will($this->returnValue(array($testModelObject)));
...

Of course my unittest throws an error: "Call to a member function toArray() on a non-object"

freshp
  • 525
  • 5
  • 20

1 Answers1

0

Simply var_dump() your real $test object, and you will see the class.

cweiske
  • 30,033
  • 14
  • 133
  • 194
  • I already know that it is of type Tx_Extbase_Persistence_QueryResult, but i dont know how to initialize it in my Test. – freshp Jan 11 '13 at 13:49
  • Your question is: "dont know which type i must return to have the toArray-method" – cweiske Jan 11 '13 at 16:10
  • yes. i can not return an array. and the Tx_Extbase_Persistence_QueryResult needs some configuartion and i dont know how. – freshp Jan 12 '13 at 10:11