Hello,
i am relatively new to unittests and Test-Driven-Development and i have some problems by beginning to test a yii-app. The theory and the basic example are
clear so far, but for the use with yii there are some question marks.
First i copied the files from yii/tests/* to my app and fixed the path in cut.php.
Now i create a SiteController with following content:
require_once(dirname(__FILE__) . "/../../../protected/controllers/SiteController.php"); class SiteControllerTest extends CTestCase { public function testRunAction() { $this->assertEquals(class_exists('SiteController'), true); $c = new SiteController(''); $this->assertEquals(is_Array($c->actions()), true); $this->assertEquals(is_Array($c->filters()), true); } }
This test works so far, but how do i test the actionIndex() method?
Or do i test it only with selenium?
How do i test Classes which extends or use AcriveRecord-Classes?
Normally yii handle the db-connection etc, but there is no yii-app running
for the unittest… The result is "Call to a member function getDb() on a non-object"
I am a litte confused right now, and may be someone can point me the way how to beginn with test-driven-development with yii?
Thank you very much
me23