$this->fetchRow creates failure in phpunit in Zend framework
===

I followed [Rob Allens ZF 1 Tutorial][1] and wanted to pimp it up with some UnitTesting. But whenever I run the phpunit command, i get the message:

    here was 1 failure:

    1) IndexControllerTest::testDeleteAction
    Failed asserting last controller used <"error"> was "Index"

    /path/to/library/Zend/Test/PHPUnit/ControllerTestCase.php:1000
    /path/to/tests/application/controllers/IndexControllerTest.php:55

    FAILURES!
    Tests: 4, Assertions: 9, Failures: 1.

The Action in question is the deleteAction and looks like this:

    public function deleteAction() {
        if ($this->getRequest()->isPost()) {
            $del = $this->getRequest()->getPost('del');
            if ($del == 'Yes') {
                $id = $this->getRequest()->getPost('id');
                $wishes = new Application_Model_DbTable_Wishes();
                $wishes->deleteWish($id);
            }
            $this->_helper->redirector('index');
        }
        else {
            $id = $this->_getParam('id', 0);
            $wishes = new Application_Model_DbTable_Wishes();
            $this->view->wish = $wishes->getWish($id);
        }
    }

I tracked the error down to be `$wishes>getWish($id);` so if i go to that function, that looks like this:

    public function getWish($id) {
        $id = (int) $id;
        $row = $this->fetchRow('id = ' . $id);
        if(!$row){
            throw new Exception("Could not find row $id");
        }
        return $row->toArray();
    }

it appears the line `$row = $this->fetchRow('id = ' . $id);` causes the problem. And I can't figure out why. All action work just fine, they do as expected.Any idea how to fix this?

Thanks!


  [1]: http://akrabat.com/zend-framework-tutorial/