I would like to know how to write PHPUnit tests with Zend_Test and in general with PHP.
feedback
|
Plus if you using a database transaction then it would be best to delete all the transaction that is gets done via a unit test otherwise your database gets all messed. so on set up
and on teardown all you need to do is rollback
So its not that hard buddy Keep Smiling Kdecom | ||||
feedback
|
Using ZF 1.10, I put some bootstrap code into tests/bootstrap.php (basically what is in (public/index.php), until $application->bootstrap(). Then I am able to run a test using
| |||
feedback
|
I found this article very useful. Also Zend_Test documentation helped a lot. With the help of these two resources, I managed to succesfully implement unit testing in the QuickStart tutorial of the Zend Framework and write few tests for it. | |||
feedback
|
They have an "Introduction to the Art of Unit Testing" on the Zend Developer Zone, which covers PHPUnit. | |||||
feedback
|
I'm using Zend_Test to completely test all controllers. It's quite simple to set up, as you only have to set up your bootstrap file (the bootstrap file itself should NOT dispatch the front controller!). My base test-case class looks like this:
where
That's all... | |||||||||||||||
feedback
|
I haven't used Zend_Test but I have written tests against apps using Zend_MVC and the like. The biggest part is getting enough of your bootstrap code in your test setup. | |||
feedback
|