cheers alecs though im not sure that your examples addresses my problem of authenticating the user before function testing a page ... what I meant by sfContext::getUser() was
<?php $user = sfContext::getInstance() -> getUser(); $user -> login($user_object); On 27 Jan, 13:00, Lupu Alexandru-Emil <[email protected]> wrote: > On Tue, Jan 27, 2009 at 1:17 PM, dantleech <[email protected]> wrote: > > > I am trying to write functional tests for an authenticated > > application, but every time I authenticate the user it seems that the > > users state is reset every time, > > > i.e. the next [-> get] doesn't seem to recognize the fact that I > > have previously authenticated the user and when running the test I > > receive the login HTML rather than the page I want to test > > > I have tried both authenticating the user using sfContext::getUser() > > and logging in manually by using: > > > $sf_test_functional -> post('/user_plugin_module/login', array('email' > > => '[email protected]', 'password' => 'blah'); > > > and the dev log seems to suggest that the user was indeed logged in, > > but the subsequent request redirects to the login page anyway .. > > > cheers > > > dan > > Hi! > before you call "sfContext::getUser()" each time, you could try > <?php > > $my_test_user = sfContext::getUser(); > $my_test_user->getFOO(); > .... > ?> > Also you might wanna try : > <?php > $context = sfContext::getInstance(); > $my_test_user = $context->getUser(); > $my_test_user->getFOO(); > .... > ?> > > Alecs --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
