Thanks Felix, that worked perfectly!  Here's what I did before my
controller test class:

Mock::generatePartial('PeopleController',
'PeopleControllerTestVersion', array('redirect'));

Then I just created the mock controller in the setUp() method:

$this->controller =& new PeopleControllerTestVersion();
$this->controller->__construct();


On 4/14/07, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
>  Yeah, check out partial mocks in the SimpleTest docs. All you need to do is
> to create one of those for the controller you are overwriting in order to
> mock the 'redirect' function. You can even assert eh redirect is executed by
> putting in:
>
>  $this->Controller->expectOnce('redirect');
>
>  Let me know if you need more details,
>  -- Felix
>
> --------------------------
>  http://www.thinkingphp.org
>  http://www.fg-webdesign.de
>
>  [EMAIL PROTECTED] wrote:
>  I'm using the new unit testing functionality in 1.2 to test one of my
> controllers. Several of its actions contain calls to the redirect()
> function which messes up the unit tests. Is there a way to prevent
> redirects from occurring in unit tests?
>
> I tried ob_start() and ob_end_clean() but the browser still gets
> redirected away from the unit test page.
>
>
>
>
>
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to