On Feb 19, 12:08 pm, Nei Rauni Santos <nra...@gmail.com> wrote:
> It worked for me, do you think it's a good solution?
>
> <?php
>
> class tools
> {
>
>   /*
>    * This code is used to allow get the user object on sf 1.3
>    * I usually used to $sf_user = sfContext::getInstance()->getUser();
>    * but it throw exception with the message: The "default" context does not
> exist.
>    * on enviroment test
>    * */
>   public static function getUser(){
>
>     $configuration =
> sfApplicationConfiguration::getApplicationConfiguration(
> sfConfig::get('sf_app') );
>     $context = sfContext::createInstance($configuration);
>     return $context->getUser();
>
>   }
>
> now, at my libs i use tools:getUser()
>


Do you need to call the user? Do you need data from the user object?
If not, you can use a mock object. If you do, then, your unit test is
really a functional test, not a unit test. You might as well be
running in the test in the context of the whole site.

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to