2009年10月12日星期一

[fw-mvc] unit test

We are trying to build a stable and easy-to-use testing system within Zend Framework.

I created a module named user, and some models such as User_Model_User class under application/modules/user/models,  actually made it work with your help. All models have extended Zend_Db_Table class.

Now I want to test the model. 

I watched a great video tutorial at: http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/, and I followed it to bulid testing framework. I have written phpunit.xml, bootstrap file, controllertestcast.php, and UserTest.php file. I add a testing function:

public function testCanItWork(){
$this->assertTrue(true);
}

in UserTest.php. Everything goes well.

When I try to test the model really, errors are reported that User_Model_User are not found, I include it and got another error message "Zend_Db_Table are not found",

I include all required files, but still get errors: Zend_Db_Table has no adapter.

I am totally confused. I don't know how to fix it.

I have found that the application has been bootstraped, but why the classes I need are not autoloaded? 

I have read configurations and register it, set default adapter for Zend_Db_Table in application's bootstrap file, and the application are bootstraped successfully, but why I can not get it?

没有评论: