本文整理汇总了PHP中FunctionalTester::amLoggedAs方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::amLoggedAs方法的具体用法?PHP FunctionalTester::amLoggedAs怎么用?PHP FunctionalTester::amLoggedAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::amLoggedAs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requireAuthenticationForRoute
public function requireAuthenticationForRoute(FunctionalTester $I)
{
$I->haveEnabledFilters();
$I->amOnPage('/secure');
$I->seeCurrentUrlEquals('/auth/login');
$I->see('Login');
$I->amLoggedAs(User::create($this->userAttributes));
$I->amOnPage('/secure');
$I->seeResponseCodeIs(200);
$I->see('Hello World');
}
示例2: requireAuthenticationForRoute
public function requireAuthenticationForRoute(FunctionalTester $I)
{
$I->dontSeeAuthentication();
$I->amOnPage('/secure');
$I->seeCurrentUrlEquals('/auth/login');
$I->see('Login');
$I->amLoggedAs(User::firstOrNew($this->userAttributes));
$I->amOnPage('/secure');
$I->seeResponseCodeIs(200);
$I->see('Hello World');
}
示例3: deleteUser
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function deleteUser(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('delete an existing user details');
$admin = $I->createUser(1, 4);
$user = $I->createUser(2, 1);
$user1 = $I->createUser(3, 2);
$I->amLoggedAs($admin);
$I->amOnAction('Administration\\UsersController@getDelete', ['user' => $user]);
$I->seeCurrentActionIs('Administration\\UsersController@getIndex');
$I->dontSee($user->fullname);
$I->see($user1->fullname);
}
示例4: viewInvalidNote
public function viewInvalidNote(FunctionalTester $I)
{
$I->am('Normal User');
$I->expectTo('see 401 error with mismatch note route parameters.');
$admin = $I->createUser(1, 4);
// admin
$project1 = $I->createProject(1, [$admin]);
$project2 = $I->createProject(2, [$admin]);
$note1 = $I->createNote(1, $admin, $project1);
$I->amLoggedAs($admin);
$I->amOnAction('ProjectController@getNotes', ['project' => $project1]);
$uri = $I->getApplication()->url->action('ProjectController@postEditNote', ['project' => $project2, 'note' => $note1], false);
$I->sendAjaxPostRequest($uri, ['body' => 'note one updated', '_token' => csrf_token()]);
$I->seeResponseCodeIs(401);
}
示例5: deleteProject
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function deleteProject(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('delete an existing project details');
$project = $I->createProject(1);
$admin = $I->createUser(1, 4);
$I->amLoggedAs($admin);
$I->amOnAction('ProjectController@getEdit', ['project' => $project]);
$I->click(trans('tinyissue.delete_something', ['name' => $project->name]));
$I->seeCurrentActionIs('ProjectsController@getIndex');
$I->dontSeeLink('Project 1');
$I->amOnAction('ProjectsController@getIndex', ['status' => Project::STATUS_ARCHIVED]);
$I->dontSeeLink('Project 1');
$I->dontSeeRecord($project->getTable(), ['name' => 'Project 1']);
}
示例6: updateTag
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function updateTag(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('edit an existing tag');
$tag = (new Tag())->where('group', '=', false)->get()->random(1);
$data = ['name' => 'tag updated'];
$tagName = $tag->name;
$I->amLoggedAs($I->createUser(1, 4));
$I->amOnAction('Administration\\TagsController@getIndex');
$I->click($this->_editTagSelector($tagName));
$I->seeCurrentActionIs('Administration\\TagsController@getEdit', ['tag' => $tag]);
$I->submitForm('form', $data);
$I->amOnAction('Administration\\TagsController@getIndex');
$I->see($data['name'], $this->_editTagSelector($data['name']));
$I->dontSee($data['name'], $this->_editTagSelector($tagName));
}
示例7: createATicketSuccessfully
public function createATicketSuccessfully(FunctionalTester $I)
{
$I->amLoggedAs(User::where('email', 'wayne@chargemasterplc.com')->first());
$I->seeAuthentication();
$I->amOnPage('/ticket/create');
$I->see('Create Ticket', 'h1');
$I->fillField('customer_name', 'Evie Martell');
$I->fillField('customer_address', 'Luton, LU1 9AB');
$I->fillField('customer_tel', '07710999888');
$I->fillField('customer_email', 'evie.martell@chargemasterplc.com');
$I->selectOption('select[name=type]', 'Fault');
$I->selectOption('select[name=category_id]', '1');
$I->fillField('post_serial', '2997');
$I->fillField('description', 'Testing the post fault');
$I->seeAuthentication();
$I->click('Create');
$I->see('Ticket created');
}
示例8: assignToUser
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function assignToUser(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('not be able to assign an issue to a user');
$admin = $I->createUser(1, 4);
$developer1 = $I->createUser(2, 2);
// developer
$I->amLoggedAs($admin);
$project = $I->createProject(1, [$developer1]);
$issue = $I->createIssue(1, $admin, null, $project);
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->dontSee($developer1->fullname, '.assigned-to .currently_assigned');
$uri = $I->getApplication()->url->action('Project\\IssueController@postAssign', ['project' => $project]);
$I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
$I->comment($I->getResponseContent());
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->see($developer1->fullname, '.assigned-to .currently_assigned');
}
示例9: deleteNote
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function deleteNote(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('delete an existing note from a project');
$admin = $I->createUser(1, 4);
$I->amLoggedAs($admin);
$project = $I->createProject(1);
$note1 = $I->createNote(1, $admin, $project);
$note2 = $I->createNote(2, $admin, $project);
$I->amOnAction('ProjectController@getNotes', ['project' => $project]);
$I->see('Note 1', '//li[@id="note' . $note1->id . '"]');
$I->see('Note 2', '//li[@id="note' . $note2->id . '"]');
$uri = $I->getApplication()->url->action('ProjectController@getDeleteNote', ['project' => $project, 'note' => $note2]);
$I->sendAjaxGetRequest($uri);
$I->seeResponseCodeIs(200);
$I->amOnAction('ProjectController@getNotes', ['project' => $project]);
$I->see('Note 1', '//li[@id="note' . $note1->id . '"]');
$I->dontSee('Note 2', '//li[@id="note' . $note2->id . '"]');
}
示例10: deleteComment
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function deleteComment(FunctionalTester $I)
{
$I->am('Developer User');
$I->wantTo('delete a comment from an issue');
$admin = $I->createUser(2, 4);
$I->amLoggedAs($admin);
$project = $I->createProject(1, [$admin]);
$issue = $I->createIssue(1, $admin, $admin, $project);
$comment1 = $I->createComment(1, $admin, $issue);
$comment2 = $I->createComment(2, $admin, $issue);
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->see($comment1->comment, '#comment' . $comment1->id . ' .content');
$I->see($comment2->comment, '#comment' . $comment2->id . ' .content');
$uri = $I->getApplication()->url->action('Project\\IssueController@getDeleteComment', ['comment' => $comment1]);
$I->sendAjaxGetRequest($uri);
$I->seeResponseCodeIs(200);
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->dontSee($comment1->comment);
$I->see($comment2->comment);
}
示例11: memberCanReturnBox
public function memberCanReturnBox(FunctionalTester $I)
{
$I->am('a member');
$I->wantTo('make sure I can return a box I own');
//Load and login a known member
$user = User::find(1);
$I->amLoggedAs($user);
//Setup a box a already claimed
$box = \BB\Entities\StorageBox::first();
$box->user_id = $user->id;
$box->save();
$I->amOnPage('/storage_boxes');
//Make sure the db is correct
$I->seeInDatabase('storage_boxes', ['user_id' => $user->id]);
//The page should have our name next to the claimed box
$I->see($user->name);
$I->click('Return Box');
//We should be gone from the DB
$I->dontSeeInDatabase('storage_boxes', ['user_id' => $user->id]);
$I->cantSee($user->name);
}
示例12: viewOverview
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function viewOverview(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('To view administration overview page');
$admin = $I->createUser(1, 4);
$project1 = $I->createProject(1);
$project2 = $I->createProject(2);
$project2->status = Tinyissue\Model\Project::STATUS_ARCHIVED;
$project2->save();
$I->createProject(3);
$I->createIssue(1, $admin, null, $project1);
$I->createIssue(2, $admin, null, $project1);
$issue3 = $I->createIssue(3, $admin, null, $project1);
$issue3->changeStatus(Project\Issue::STATUS_CLOSED, $admin);
$I->amLoggedAs($admin);
$I->amOnAction('HomeController@getIndex');
$I->click(trans('tinyissue.administration'));
$I->seeCurrentActionIs('AdministrationController@getIndex');
$I->see('1', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.total_users') . '\')]]/span');
$I->see('2', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.active_projects') . '\')]]/span');
$I->see('1', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.archived_projects') . '\')]]/span');
$I->see('2', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.open_issues') . '\')]]/span');
$I->see('1', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.closed_issues') . '\')]]/span');
}
示例13: removeUserFromProject
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function removeUserFromProject(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('not be able to remove user to a project');
$admin = $I->createUser(1, 4);
$developer1 = $I->createUser(2, 2);
// developer
$I->amLoggedAs($admin);
$project = $I->createProject(1, [$developer1]);
$I->amOnAction('ProjectController@getIndex', ['project' => $project]);
$I->see($developer1->fullname, '#project-user' . $developer1->id);
$uri = $I->getApplication()->url->action('ProjectController@postUnassign', ['project' => $project]);
$I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
$I->amOnAction('ProjectController@getIndex', ['project' => $project]);
$I->dontSee($developer1->fullname, '#project-user' . $developer1->id);
}
示例14: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->amLoggedAs(['username' => 'crist_lopez', 'password' => 'testing1234']);
$I->seeAuthentication();
$I->wantTo('change my account password');
$I->amOnPage('/dashboard');
$I->click('Profile');
$I->see('My Profile');
$I->click('(Change Password)');
$I->see('Account Details');
$I->fillField('old_password', 'testing1234');
$I->fillField('password', 'testing123');
$I->fillField('password', 'testing123');
$I->click('Submit');
$password = Hash::make('testing123');
$I->seeRecord('accounts', ['username' => 'crist_lopez', 'password' => $password]);
示例15: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->amLoggedAs(['username' => 'crist_lopez', 'password' => '123456']);
$I->seeAuthentication();
$I->wantTo('create an account for a BCD employee');
$username = 'dickie_soriano';
$password = 'testing1234';
$password_again = 'testing1234';
$first_name = 'J. Richards';
$middle_name = 'Testing';
$last_name = 'Soriano';
$birthdate = '07/04/1965';
$address = 'Greater Manila, Quezon City';
$email = 'dickie_soriano@bcdpinpoint.com';
$mobile = '09234545432';
$department = 'D-DIGI';
$I->amOnPage('/employees/create');
$I->see('Add Employee Record');
$I->fillField('username', $username);
$I->fillField('password', $password);
$I->fillField('password_again', $password);
$I->fillField('first_name', $first_name);
$I->fillField('middle_name', $middle_name);
$I->fillField('last_name', $last_name);
$I->fillField('birthdate', $birthdate);
$I->fillField('address', $address);
$I->fillField('email', $email);
$I->fillField('mobile', $mobile);
$I->fillField('department', $department);
$I->click('Submit');