-- Andrey Korolyov <akorol...@gmail.com> wrote (on Saturday, 11 September 2010, 01:07 AM +0300): > It for test controllers. For example: > I want use Doctrine in my tests or create specific view renderer. In > this case I want to init application and run all test in with fully > initialized Application. > But as I understand your response I need to create mock objects for my > resources and init it for each test, isn't it?
In your setUp(), do similar to what I recommend for the ControllerTestCase: setup your Zend_Application instance. Once setup, intialize the resources necessary for that test: public function setUp() { $application = new Zend_Application( 'testing', APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap('doctrine'); // or whatever resource you // want to access $this->doctrineManager = $application->getResource('doctrine'); } >From there, it's all just unit testing. > 2010/9/11 Hector Virgen <djvir...@gmail.com>: > > BTW if you need to stub in a mock resource in your bootstrap, you can do > > this: http://pastie.org/1151031 > > -- > > Hector Virgen > > Sr. Web Developer > > Walt Disney Parks and Resorts Online > > http://www.virgentech.com > > > > > > On Fri, Sep 10, 2010 at 2:46 PM, Hector Virgen <djvir...@gmail.com> wrote: > >> > >> Zend_Test (an extension of PHPUnit included in ZF) can be used to unit > >> test your controllers. Also take a look at Matthew's blog post: > >> > >> http://weierophinney.net/matthew/archives/182-Testing-Zend-Framework-MVC-Applications.html > >> > >> -- > >> Hector Virgen > >> Sr. Web Developer > >> Walt Disney Parks and Resorts Online > >> http://www.virgentech.com > >> > >> > >> On Fri, Sep 10, 2010 at 2:37 PM, Andrey Korolyov <akorol...@gmail.com> > >> wrote: > >>> > >>> How to run unit test from framework environment? > >>> At this moment I see only one way. this is initialize Application and > >>> preset all resource plugins at setUp for each test. In Zend_Tests i > >>> found only tests for DBModels and Controller_Action. What about > >>> Zend_Application environment? > >>> > >>> -- > >>> Andrey Korolyov | WEB Developer > >>> > >>> e | akorol...@gmail.com > >>> skype | andrey.korolyov > >> > > > > > > > > -- > Andrey Korolyov | WEB Developer > > e | akorol...@gmail.com > skype | andrey.korolyov > -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc