Here's how I do this:
        $view =& ClassRegistry::getObject('view');
        $some_view_var = isset($view->viewVars['var']
['another_var']) ? $view->viewVars['var']['another_var'] : null;
I am aware that it is against CakePHP coding conventions to use the
tertiary conditional operator, but I don't care. :P

Cheers

Jacob

On Apr 25, 4:08 pm, wratke <[email protected]> wrote:
> I'm wondering if there's any way to get the viewVars when unit testing
> a
> controller without using the testAction. I've taken a look at the
> testAction function in the Cake code and see how it gets the View
> object
> and then dumps and returns the viewVars, but as far as I can tell
> there
> isn't any way to do something similar without using the testAction
> function. Is there something in Cake that allows you to access the
> viewVars that I'm missing? Or should I be dumping the viewVars from
> the
> View object manually in my tests? I'm excited to start testing my
> controllers with Mock objects, but without having access to the
> viewVars
> set in the controller I'm finding it difficult to make any assertions
> in
> my tests to make sure things are being set properly.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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