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 = $newUser->encrypt($password);





                              'email' => $newUserMail,

                              'password' =>$password,

			      'password_repeat' => 	$passwordRepeat








How can i test this?



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?


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