Hi juro!

I think that at this point you've maybe solved your problem, but I'll
answer the question anyway for future references, other people
reference.

It's always a good practice to check out symfony's code, it's a very
good self-documentation. For this, the unit tests of the user classes
are the solution:

http://trac.symfony-project.org/browser/branches/1.2/test/unit/user

HTH. Greetings!

On 8 ene, 11:08, juro <fo...@juro.at> wrote:
> 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