Unit test and captcha

Hi, i have a basic user model and i have the next validation:

array(‘verifyCode’, ‘captcha’, ‘allowEmpty’ => false, ‘on’ => ‘create,create_widget’),

when i run my unit test fails because i don’t know the captcha code

public function testCreate(){


 	//Create a new user


	$newUser=new User('create');


	$newUserMail = 'test@ticketea.com';


	$password='pruebatest';


	$passwordRepeat='pruebatest';


	$password = $newUser->encrypt($password);


	$this->assertNotEquals($password,$passwordRepeat);


	$passwordRepeat=$password;


            $newUser->setAttributes(


                               array(


                              'email' => $newUserMail,


                              'password' =>$password,


			      'password_repeat' => 	$passwordRepeat


                   


                 )


          	);


	$this->assertTrue($newUser->save());


		


	


}

How can i test this?

regards

hi

this is my quiestion too :)

plus, ccaptchavalidator fail, because Yii::app()->controller is null

(Fatal error: Call to a member function createAction() on a non-object in framework/validators/CCaptchaValidator.php on line 65)

how can i unit test captcha?

thx

i did the next thing on test function:


...

$c = Yii::app()->createController('module/action');

Yii::app()->controller = $c[0];

$captcha = new CCaptchaAction(Yii::app()->controller, 'captcha');

$model->captcha = $captcha->getVerifyCode();

...

i think it is not a beauty solution, but it solved the controller is null problem, and i know the captcha code on unit test function