本文整理汇总了PHP中FunctionalTester::am方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::am方法的具体用法?PHP FunctionalTester::am怎么用?PHP FunctionalTester::am使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::am方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: guestCantVisitRolesPage
public function guestCantVisitRolesPage(FunctionalTester $I)
{
$I->am('a guest');
$I->wantTo('make sure I can\'t view the roles page');
//I can see the menu item
$I->amOnPage('/roles');
$I->canSeeCurrentUrlEquals('/login');
}
示例2: canFetchPhoto
public function canFetchPhoto(FunctionalTester $I)
{
$I->am('a developer');
$I->wantTo('ensure photos can be fetched');
$equipment = \BB\Entities\Equipment::findOrFail(2);
$equipment->addPhoto('foo.png');
$equipment = \BB\Entities\Equipment::findOrFail(2);
$I->assertEquals($equipment->getPhotoBasePath() . 'foo.png', $equipment->getPhotoPath(0));
}
示例3: tryToCreateModifyAndDeleteContent
public function tryToCreateModifyAndDeleteContent(FunctionalTester $I)
{
$I->am('Anonymous user');
$I->sendPOST('api/contents.json', $this->content3);
$I->seeResponseCodeIs(401);
$I->sendPUT('api/contents/' . $this->content2['key'] . '.json');
$I->seeResponseCodeIs(401);
$I->sendDELETE('api/contents/' . $this->content2['key'] . '.json');
$I->seeResponseCodeIs(401);
$I->am('ROLE_USER');
$I->login($this->user['email']);
$I->sendPOST('api/contents.json', $this->content3);
$I->seeResponseCodeIs(403);
$I->sendPUT('api/contents/' . $this->content2['key'] . '.json');
$I->seeResponseCodeIs(403);
$I->sendDELETE('api/contents/' . $this->content2['key'] . '.json');
$I->seeResponseCodeIs(403);
$I->am('ROLE_ADMIN');
$I->login($this->admin['email']);
$I->sendPOST('api/contents.json', $this->content3);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->content3);
$id = $I->grabDataFromResponseByJsonPath('$.id')[0];
$I->sendGET('api/contents/' . $this->content3['key'] . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->content3);
$I->sendGET('api/contents/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->content3);
$this->content3['title'] = 'new title';
$I->sendPUT('api/contents/' . $id . '.json', $this->content3);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->content3);
$I->sendGET('api/contents/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->content3);
$I->sendDELETE('api/contents/' . $id . '.json');
$I->seeResponseCodeIs(204);
$I->sendGET('api/contents/' . $id . '.json');
$I->seeResponseCodeIs(404);
$I->logout();
$I->sendGET('api/contents/' . $id . '.json');
$I->seeResponseCodeIs(401);
}
示例4: tryToCreateModifyAndDeleteEvent
public function tryToCreateModifyAndDeleteEvent(FunctionalTester $I)
{
$I->am('Anonymous user');
$I->sendPOST('api/events.json', $this->event3);
$I->seeResponseCodeIs(401);
$I->sendPUT('api/events/' . $this->event2Id . '.json');
$I->seeResponseCodeIs(401);
$I->sendDELETE('api/events/' . $this->event2Id . '.json');
$I->seeResponseCodeIs(401);
$I->am('ROLE_USER');
$I->login($this->user['email']);
$I->sendPOST('api/events.json', $this->event3);
$I->seeResponseCodeIs(400);
$this->event3['type'] = 'conference';
$I->sendPOST('api/events.json', $this->event3);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->event3);
$id = $I->grabDataFromResponseByJsonPath('$.id')[0];
$I->sendGET('api/events/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->event3);
$this->event3['name'] = 'new name';
$I->sendPUT('api/events/' . $id . '.json', $this->event3);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->event3);
$I->sendGET('api/events/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->event3);
$I->sendDELETE('api/events/' . $id . '.json');
$I->seeResponseCodeIs(204);
$I->sendGET('api/events/' . $id . '.json');
$I->seeResponseCodeIs(404);
$I->sendPOST('api/events.json', $this->event4);
$I->seeResponseCodeIs(200);
$this->event4['dateEnd'] = $this->event4['dateStart'];
$I->seeResponseContainsJson($this->event4);
$id = $I->grabDataFromResponseByJsonPath('$.id')[0];
$this->event4['data'] = ['some' => ['custom', 'data'], 'to' => ['check' => 'if arbitrary data can be stored']];
$I->sendPUT('api/events/' . $id . '.json', $this->event4);
$I->sendGET('api/events/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->event4);
}
示例5: tryToCreateModifyAndDeleteTeam
public function tryToCreateModifyAndDeleteTeam(FunctionalTester $I)
{
$I->am('Anonymous user');
$I->sendPOST('api/teams.json', $this->team3);
$I->seeResponseCodeIs(401);
$I->sendPUT('api/teams/' . $this->team2Id . '.json');
$I->seeResponseCodeIs(401);
$I->sendDELETE('api/teams/' . $this->team2Id . '.json');
$I->seeResponseCodeIs(401);
$I->am('ROLE_USER');
$I->login($this->user['email']);
$I->sendPOST('api/teams.json', $this->team3);
$I->seeResponseCodeIs(403);
$I->sendPUT('api/teams/' . $this->team2Id . '.json');
$I->seeResponseCodeIs(403);
$I->sendDELETE('api/teams/' . $this->team2Id . '.json');
$I->seeResponseCodeIs(403);
$I->am('ROLE_ADMIN');
$I->login($this->admin['email']);
$I->sendPOST('api/teams.json', $this->team3);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->team3);
$id = $I->grabDataFromResponseByJsonPath('$.id')[0];
$I->sendGET('api/teams/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->team3);
$I->sendGET('api/teams/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->team3);
$this->team3['name'] = 'new name';
$I->sendPUT('api/teams/' . $id . '.json', $this->team3);
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->team3);
$I->sendGET('api/teams/' . $id . '.json');
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson($this->team3);
$I->sendDELETE('api/teams/' . $id . '.json');
$I->seeResponseCodeIs(204);
$I->sendGET('api/teams/' . $id . '.json');
$I->seeResponseCodeIs(404);
}
示例6: memberCanLeave
public function memberCanLeave(FunctionalTester $I)
{
$I->am('a member');
$I->wantTo('leave build brighton');
//Load and login a known member
$user = User::find(1);
Auth::login($user);
$I->amOnPage('/account/' . $user->id . '');
$I->canSee('Active');
$I->click("Leave Build Brighton");
$I->canSee('Leaving');
}
示例7: teamMemberCanEditLog
public function teamMemberCanEditLog(FunctionalTester $I)
{
$I->am('a laser team member');
$I->wantTo('make sure I can edit laser logs');
//Load and login a known admin member
$user = $I->loginLaserTeamMember();
$otherUser = User::find(1);
$I->amOnPage('/equipment/laser');
$I->see($otherUser->name);
$I->selectOption('form[name=equipmentLog] select[name=reason]', 'testing');
$I->click('Update');
}
示例8: financeMemberCanVisitPaymentPage
public function financeMemberCanVisitPaymentPage(FunctionalTester $I)
{
$I->am('a member of the finance group');
$I->wantTo('make sure I can view the payments page');
//Load and login a known member
$user = User::find(3);
$role = Role::findByName('finance');
$role->users()->attach($user->id);
Auth::login($user);
$I->amOnPage('/payments');
$I->seeCurrentUrlEquals('/payments');
$I->see('Payments');
}
示例9: 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);
}
示例10: 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']);
}
示例11: 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);
}
示例12: 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));
}
示例13: adminCanDeclineExpenses
public function adminCanDeclineExpenses(FunctionalTester $I)
{
$I->am('an admin');
$I->wantTo('make sure I can decline an expense');
//Create a proposal that's currently open
$I->haveInDatabase('expenses', ['id' => 4, 'category' => 'consumables', 'description' => 'Another Description', 'user_id' => '3', 'amount' => 1234, 'expense_date' => Carbon::now()]);
//Load and login a known member
$user = User::find(3);
Auth::login($user);
$I->amOnPage('/expenses');
$I->canSee('Expenses');
$I->canSee('Another Description');
$I->cantSee('Declined by');
$I->click('Decline');
$I->canSee('Declined by');
}
示例14: 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');
}
示例15: 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 . '"]');
}