Help by testing a yii-app

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

Unfortunately, Yii currently doesn't have the testing framework for you to do test-driven programming. We will definitely add one by 1.1 release.

Qiang & Wei - I think unit testing would be a GREAT addition to Yii.  Either by using a framework addon or built-in to Yii.  Whichever makes the most sense.

Thanks again for all your efforts!

I vote for an addon: SimpleTest + SeleniumRC.

And yes, this should be based on CConsoleApplication

(PHING nervously smokes aside).

Hi there!

First of all thanks for the great work you've done by now!!

I just found this post, and what should I say…  :-[

… I also like to vote for the testing framework…

…this would be very usefull.

maximaexchen