Hi,

Have a look here:

(Section 9.6)
http://www.survivethedeepend.com/zendframeworkbook/en/1.0/implementing.the.domain.model.entries.and.authors

It has a pretty good simple example of how to set ZF up with PHPUnit.

(if you wonder, the file TestHelper.php referenced can be found in the
comments)

Thanks
Dan



2009/11/22 Davout <[email protected]>

>
>
>
> Daniel Latter wrote:
> >
> >
> > I don't think you need to extend Zend_Test_PHPUnit_ControllerTestCase
> > for your models. As far as I understand this class is there to provide
> > controllers with methods to make them easily testable. Models should
> > be independant and therefore easily testable anyway. Hope this males
> > sense.
> >
> > On 22 Nov 2009, at 10:04, Davout <[email protected]> wrote:
> >
> >>
> >> Never mind. I got it to work. Apparently, at some point in the
> >> hierarchy I
> >> have to extend Zend_Test_PHPUnit_ControllerTestCase
> >>
> >> class Order_Model_OrderRepositoryTest extends ControllerTestCase
> >>
> >> class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
> >> --
> >> View this message in context:
> >>
> http://n4.nabble.com/Bootstrapping-modules-and-testing-tp680333p758621.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
>
> Daniel,
>
> Thanks for the feedback. It makes perfect sense. And that's how I would
> think it should work. I created ModelTestCase.php
> <?php
> require_once 'Zend/Application.php';
>
> abstract class ModelTestCase extends PHPUnit_Framework_TestCase
> {
>    public $application;
>
>    public function setUp()
>    {
>        $this->application = new Zend_Application(
>            APPLICATION_ENV,
>            APPLICATION_PATH . '/configs/application.ini'
>        );
>
>        $this->bootstrap = array($this, 'appBootstrap');
>        parent::setUp();
>    }
>
>    public function appBootstrap()
>    {
>        $this->application->bootstrap();
>    }
> }
>
> And had my test extend that. However, running test does not generate any
> output. But now I find out even if I use the ControllerTestCase if my test
> class implements its own setUp
>
> protected function setUp(){
>         ....
>        parent::setUp();
>         ....
>    }
>
> No output is generated. Obviously something in my setup is not correct. Any
> ideas?
>
> Thanks.
> --
> View this message in context:
> http://n4.nabble.com/Bootstrapping-modules-and-testing-tp680333p758689.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to