Autocomplete widget and Unit Testing

Hi guys, I am trying to write a simple unit test for my autocomplete widget controller function. The autocomplete controller code follows the pattern explained in this tutorial:

Using CAutoComplete to display one value and submit another

so basically I need to simulate an ajax request from in my testAutoCompleteLookup method, so that the test can satisfy this condition

if(Yii::app()->request->isAjaxRequest && isset($_GET['q']) ...

How can I do this? Is there any CTestCase function I can use?

What you want is probably a functional test, not a unit test. Functional tests simulate a web browser visiting your application (Selenium). See here:

But in my experience there are some cases that are hard to test, even with functional tests.

I completely forgot about functional!

thanks Mike!