本文整理汇总了PHP中WebGuy::haveInDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP WebGuy::haveInDatabase方法的具体用法?PHP WebGuy::haveInDatabase怎么用?PHP WebGuy::haveInDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebGuy
的用法示例。
在下文中一共展示了WebGuy::haveInDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create(WebGuy $I, $id)
{
$I->haveInDatabase('bolt_users', array('id' => $id, 'username' => $this->username, 'password' => $this->getHashedPassword(), 'email' => $this->username . '@example.org', 'lastseen' => '1900-01-01', 'lastip' => '', 'displayname' => ucwords($this->username), 'stack' => serialize(array()), 'enabled' => '1', 'shadowpassword' => '', 'shadowtoken' => '', 'shadowvalidity' => '1900-01-01', 'failedlogins' => '0', 'throttleduntil' => '1900-01-01', 'roles' => json_encode($this->roles)));
}
示例2: WebGuy
*
* @author Brett O'Donnell <cornernote@gmail.com>
* @author Zain Ul abidin <zainengineer@gmail.com>
* @copyright 2013 Mr PHP
* @link https://github.com/cornernote/yii-account-module
* @license BSD-3-Clause https://raw.github.com/cornernote/yii-account-module/master/LICENSE
*
* @package yii-account-module
*/
$I = new WebGuy($scenario);
$I->wantTo('ensure AccountAccountController activate works');
// check we are not logged in
$I->amOnPage('/');
$I->see('Hello guest');
// add user to the database
$I->haveInDatabase('account_user', array('username' => 'demo-activate', 'password' => '$2a$13$.m7wlozeIJuRtKp01lR4peYybArVLdO6Pf1JsPSnX6eISL9GXDWBu', 'first_name' => 'demo-activate', 'last_name' => 'demo-activate', 'email' => 'demo-activate@mailinator.com', 'activated' => 0));
// add a token to the database
$I->haveInDatabase('token', array('token' => '$2a$13$lRkdb6kwbIC9aGTkdei2h.NQNlZht9Bpdo2J0PqsJ3tHAFsYJNg7C', 'model_name' => 'AccountActivate', 'model_id' => 2, 'uses_allowed' => 1, 'uses_remaining' => 1, 'expires' => strtotime('+1day'), 'created' => time()));
// check with invalid token
$I->amOnPage('/account/account/activate/user_id/2/token/test-invalid-token');
$I->see('Invalid token.');
// reset password with empty details
$I->amOnPage('/account/account/activate/user_id/2/token/test-token');
$I->see('Your account has been activated and you have been logged in.');
// check login
$I->amOnPage('/');
$I->see('Hello demo-activate');
// logout
$I->amOnPage('/account/account/logout');
$I->see('Your have been logged out.');
// ensure token is expired
示例3: WebGuy
*
* @author Brett O'Donnell <cornernote@gmail.com>
* @author Zain Ul abidin <zainengineer@gmail.com>
* @copyright 2013 Mr PHP
* @link https://github.com/cornernote/yii-account-module
* @license BSD-3-Clause https://raw.github.com/cornernote/yii-account-module/master/LICENSE
*
* @package yii-account-module
*/
$I = new WebGuy($scenario);
$I->wantTo('ensure AccountAccountController reset password works');
// check we are not logged in
$I->amOnPage('/');
$I->see('Hello guest');
// add a token to the database
$I->haveInDatabase('token', array('token' => '$2a$13$lRkdb6kwbIC9aGTkdei2h.NQNlZht9Bpdo2J0PqsJ3tHAFsYJNg7C', 'model_name' => 'AccountLostPassword', 'model_id' => 1, 'uses_allowed' => 1, 'uses_remaining' => 1, 'expires' => strtotime('+1day'), 'created' => time()));
// check with invalid token
$I->amOnPage('/account/account/resetPassword/user_id/1/token/test-invalid-token');
$I->see('Invalid token.');
// reset password with empty details
$I->amOnPage('/account/account/resetPassword/user_id/1/token/test-token');
$I->fillField('AccountResetPassword_new_password', '');
$I->fillField('AccountResetPassword_confirm_password', '');
$I->click('Save Password');
$I->see('Please fix the following input errors:');
$I->see('New Password cannot be blank.');
$I->see('Confirm Password cannot be blank.');
// reset password with password mismatch
$I->amOnPage('/account/account/resetPassword/user_id/1/token/test-token');
$I->fillField('AccountResetPassword_new_password', 'admin123');
$I->fillField('AccountResetPassword_confirm_password', 'admin321');