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()

Nei


On Fri, Feb 19, 2010 at 12:10 PM, Nei Rauni Santos <[email protected]> wrote:

> I'm trying to write unit tests and all methods that I use
> sfContext::getInstance()->getUser() not work. I always get this error The
> "default" context does not exist.
>
> My libs check informations on user's attributes, so I need get the user
> object.
>
> I need fix it to another way but I didn't find a solution. Can you help me?
>
>
>
> Nei
>
>
>
>
>
> --
> Nei Rauni Santos
> [email protected]
> +55 41 85020985
>



-- 
Nei Rauni Santos
[email protected]
+55 41 85020985

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en.

Reply via email to