$sf_user->setAttribute('myownkey', 'myownval');But you are in a funcitonnal test, here is how i did it
$storage = new sfSessionTestStorage(array(
'session_path' => sfConfig::get('sf_test_cache_dir')."/sessions"
));
$storage->write('symfony/user/sfUser/attributes', array(
'symfony/user/sfUser/attributes' => array(
'myownkey' =>'myownval'
)
));
$storage->shutdown();

1 comments:
After setting an attribute in this way, are you able to check it using, e.g.,
$browser = new sfTestFunctional(new sfBrowser());
$browser->
get('/')->
with('user')->begin()->
isAttribute('myownkey', 'myownval')->
end();
or is there another way? I am trying to use this for setting a captcha value in the user session before submitting a form with the same captcha value from my functional test, but I can't seem to get this working..
Post a Comment