Hi,
I have extended the save() method of a few of my models like this

public function save(Doctrine_Connection $conn = null)
  {
    $user = sfContext::getInstance()->getUser()->getGuardUser();

    if($this->isNew())
    {
      $this->setCreatedBy($user);
    }
    $this->setUpdatedBy($user);

    $tag = $this->getTag();
    if ($this->getTimein() != '' && $this->getTimeout() == '')
    {
      $this->setActive(1);
      $tag->setActive(1);
    }
    elseif ($this->getTimein() != '' && $this->getTimeout() != '')
    {
      $this->setActive(0);
      $tag->setActive(0);
    }
    $tag->save();

    parent::save();
  }

to store the user's id, when the object is saved.

When I test this, I get an error that there is no sfContext - which I
understand, as this is not run in the brower.

How can I run unit tests on this anyway?

juro
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@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