Hi,

I am writing functional tests where I change the usergroups. I got the
following piece of code:

--- somewhere in an action.php ---
        private function someFunction()
        {
                $user = $this->getUser();

                $user->addGroupByName('BasicUser');
                $user->removeFromGroupByName('DemoAccount');
        }
-------------------------------------------

--- functional test ---
$browser->createActivatedUser()->
        info('Change email')->
        get('/preferences')->
                isStatusCode()->
                isRequestParameter('module', 'preferences')->
                isRequestParameter('action', 'index')->
                setField('changemail[email]', '[email protected]')->
                setField('changemail[password]', 'mynewpasswd')->
        click('Save new email')->
                isStatusCode(200)-> ... // get 404 here

;
--------------------------

The reason for 404 is the following: in my update method, there is the
following line
--------------------------
$this->forward404Unless($this->getUser()->hasGroup('BasicUser'));
--------------------------

The user should be in group 'BasicUser' - when I do everything
manually, it works. I logged the current groups just before the
forward404unless:
$this->logMessage("HASGROUP: " . (implode(",", $this->getUser()-
>getGroupNames()), sfLogger::getPriorityName(1));
And it says I am 'DemoAccount'.

What happens here? Does it not refresh the groups? Why?
--~--~---------~--~----~------------~-------~--~----~
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