View Single Post
  #1 (permalink)  
Old 07-08-2007, 05:58 PM
Vincentt Vincentt is offline
Junior Member
 
Join Date: Jul 2007
Location: The Netherlands
Posts: 15
Default [SOLVED] How can I imitate Zend_Db_Table results with PHPUnit?

Hello, though being new to both the Zend Framework and PHPUnit, I am now trying to write unit tests.

Now I want to test if the latest entries are being shown, so I though I'd insert a Stub that pretends to be the "Entries" class which should extend Zend_Db_Table. However, I don't know how I should set the return value to the results. I currently have this code:
PHP Code:
$entries $this->getMock('Entries');
$entries->expect($this->any())
          ->
method('fetchAll')
          ->
will($this->returnValue('foo')); 
Here, I'd like to replace 'foo' with fake results from Entries::fetchAll() . How do I do that?

Thanks in advance.

Last edited by Vincentt : 07-18-2007 at 01:00 PM. Reason: Solved :D
Reply With Quote