>On Tue, Jul 12, 2016 at 11:01 AM, Daniel Barrett <mailto:[email protected]> >wrote: >> What is the proper incantation for faking a successful login (for a given >> user) as part of a unit test? My old code was: >> >> $context = RequestContext::getMain(); >> $specialPage = new LoginForm( $context->getRequest() ); >> $user->logout(); >> $specialPage->showReturnToPage('successredirect'); >> $specialPage->successfulLogin(); >> >> What is the right way to perform this task with AuthManager?
Brad Jorsch (Anomie) asks: >What is the task exactly? Just outputting a "login successful" page without >actually logging the user in? I guess the equivalent would be to call >SpecialUserLogin::successfulAction() (using TestingAccessWrapper). Thanks Brad. I have an extension that takes a special action when a user logs in for the first time. (It automatically creates the user page, User:Username.) I have a unit test that creates a user, logs that user in (as above), and then checks that the user page was created. With the LoginForm class deprecated, I am looking for the right way to implement this test in MW 1.27. Any insights are appreciated. Thank you, DanB _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
