> Hi !
> 
> So, here is my problem :
> 
> I try to test a Zend Framework application with PHPUnit.
> 
> All my tests extend the class "TestsController" you can see below :
> 
> class TestsController extends Zend_Test_PHPUnit_ControllerTestCase
> {
> 
>        public function setUp()
>    {  
> 
>        $this->bootstrap = new
> Zend_Application(APPLICATION_ENV,APPLICATION_PATH .
> '/configs/application.ini');
>        $this->bootstrap->bootstrap(array(...module list...));
>       //Setup Test's database
>    }
> 
>    public function tearDown()
>    {
>      //delete test's database      
>    }
> }
> 
> Then, in an other file, I create my test Class which extends TestsController
> :
> 
> class SomethingControllerTest extends TestsController
> {
>        public function Test1()
>    {
>    }
> 
>        public function Test2()
>    {
>    }
> 
>        public function Test3()
>    {
>    }
> }
> 
> Every time a Test method is executed (Test1, Test2...), the plugins defined
> in my config.ini are registered one more time by the Broker
> (Zend_Controller_Plugin_Broker).
> 
> // config.ini excerpt
> resources.frontController.plugins[] = "Plugin_First"
> resources.frontController.plugins[] = "Plugin_Second"
> 
> How can I avoid it ?

Hi,

First: In your TestController::setUp() method you probably forgot to call 
parent::setUp();
Second: Are your tests running in process isolation? You can turn this on in 
your phpunit.xml.

I've no real experience unit-testing a ZF application, but maybe it helps.

Cheers, Dennis

Reply via email to