本文整理汇总了PHP中sfTestFunctional::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP sfTestFunctional::getUser方法的具体用法?PHP sfTestFunctional::getUser怎么用?PHP sfTestFunctional::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfTestFunctional
的用法示例。
在下文中一共展示了sfTestFunctional::getUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$user = new QubitUser();
$user->username = 'Test McTester';
$user->email = 'test@example.com';
$user->setPassword('test1234');
$user->save();
$browser->info('Log in')->post(';user/login', array('email' => 'test@example.com', 'password' => 'test1234'))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok($browser->getUser()->isAuthenticated(), 'User is authenticated');
$browser->test()->isa_ok($browser->getUser()->user, 'QubitUser', 'myUser->user is QubitUser');
$browser->info('Log out')->get('/')->with('request')->begin()->isParameter('module', 'staticpage')->isParameter('action', 'static')->end()->click('Log out')->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'logout')->end();
$browser->test()->ok(!$browser->getUser()->isAuthenticated(), 'User isn\'t authenticated');
$browser = new sfTestFunctional(new sfBrowser());
$browser->info('Incorrect log in')->post(';user/login', array('email' => 'test@example.com', 'password' => 'wrongpass'))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok(!$browser->getUser()->isAuthenticated(), 'User isn\'t authenticated');
$browser->test()->is($browser->getUser()->user, null, 'myUser->user is null');
$browser = new sfTestFunctional(new sfBrowser());
$browser->info('"localhost" "next" parameter, issue 1342')->post(';user/login', array('email' => 'test@example.com', 'password' => 'test1234', 'next' => 'http://localhost/example'))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok($browser->getUser()->isAuthenticated(), 'User is authenticated');
$browser->test()->isa_ok($browser->getUser()->user, 'QubitUser', 'myUser->user is QubitUser');
$browser = new sfTestFunctional(new sfBrowser());
$browser->info('Empty "next" parameter')->post(';user/login', array('email' => 'test@example.com', 'password' => 'test1234', 'next' => ''))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'login')->end();
$browser->test()->ok($browser->getUser()->isAuthenticated(), 'User is authenticated');
$browser->test()->isa_ok($browser->getUser()->user, 'QubitUser', 'myUser->user is QubitUser');
$user->delete();