Hi,

I have some unit testing set up and working fine.  However, once the second
test fires, it dies with a fatal error: Cannot redeclare class
Zend_Mail_Transport_Smtp in /path/to/Zend/Mail/Transport/Smtp.php on line
243

I've figured out that the unit tests are trying to load the mail resource
plugin I have specified each time a test runs, which gives me this error. 
Here is the relevant section of application.ini:

resources.mail.transport.type           = smtp
resources.mail.transport.host           = "smtp.server.com"
resources.mail.transport.auth           = login
resources.mail.transport.username       = [email protected]
resources.mail.transport.password       = myPassword
resources.mail.transport.register               = true

My unit test bootstrapping looks like this:

public function setUp(){        
    $this->bootstrap = array($this, 'appBootstrap');
    parent::setUp();
}
    
public function tearDown(){
    parent::tearDown();
}
        
public function appBootstrap()
{
    $this->application = new Zend_Application(APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini');
    $this->application->bootstrap();
}

If I comment out the resources.mail section of my application.ini, all tests
proceed as expected.  So my question is: how do I get the tearDown() method
to also tear down my resource plugins?


-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/PHPUnit-and-using-tearDown-on-Resource-Plugins-tp2173162p2173162.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to