本文整理汇总了PHP中FunctionalTester::seeResponseCodeIs方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::seeResponseCodeIs方法的具体用法?PHP FunctionalTester::seeResponseCodeIs怎么用?PHP FunctionalTester::seeResponseCodeIs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::seeResponseCodeIs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAuthEndpoint
public function checkAuthEndpoint(FunctionalTester $I)
{
$I->wantTo('Visit login endpoint');
$I->amOnPage('login');
$I->seeResponseCodeIs(200);
$I->wantTo('Visit register endpoint');
$I->amOnPage('register');
$I->seeResponseCodeIs(200);
}
示例2: updateIssue
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function updateIssue(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('edit an existing project issue details');
$admin = $I->createUser(1, 4);
$developer1 = $I->createUser(2, 2);
// developer
$I->amLoggedAs($admin);
$project = $I->createProject(1, [$developer1]);
$I->amOnAction('Project\\IssueController@getNew', ['project' => $project]);
$issue = $I->createIssue(1, $admin, $developer1, $project);
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->seeLink('Issue 1');
$I->dontSee(\Html::duration($issue->time_quote), '.issue-quote');
$I->click('Issue 1', '.edit-issue');
$I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]);
$newTitle = 'Issue 1 update';
$newTime = 3700;
$I->fillField('title', $newTitle);
$I->fillField('time_quote[h]', 1);
$I->fillField('time_quote[s]', 100);
$I->fillField('tag', 'type:tag1');
$I->click(trans('tinyissue.update_issue'));
$I->seeResponseCodeIs(200);
$I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->seeLink($newTitle);
$I->see(\Html::duration($newTime), '.issue-quote');
$I->see('type', '.issue-tag');
$I->see('tag1', '.issue-tag');
}
示例3: tryingToCreateWithEmptyContent
public function tryingToCreateWithEmptyContent(FunctionalTester $I)
{
$I->disableMiddleware();
$I->amOnRoute('microblog.home');
$I->sendAjaxPostRequest(route('microblog.save'), array('text' => ''));
// POST
$I->seeResponseCodeIs(422);
}
示例4: ResponseOfInvalidSourceIsJson
public function ResponseOfInvalidSourceIsJson(Tester $I)
{
$I->wantToTest('response is JSON if we provide an Invalid Source');
$I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
$I->sendGET("currenttime", ["source" => 'blahblahblah']);
$I->seeResponseCodeIs(401);
$I->seeResponseIsJson();
}
示例5: updateItem
public function updateItem(FunctionalTester $I, $scenario)
{
$I->wantTo('modify an existing item');
$I->sendPUT('/vehicles/123', ['name' => 'Pansy updated']);
$scenario->incomplete('work in progress');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['id' => 123, 'name' => 'Pansy updated']);
}
示例6: it_should_insert_a_comment_when_hitting_the_endpoint_with_valid_params
/**
* @test
* it should insert a comment when hitting the endpoint with valid params
*/
public function it_should_insert_a_comment_when_hitting_the_endpoint_with_valid_params(\FunctionalTester $I)
{
$post_id = $I->havePostInDatabase(['post_title' => 'Some post']);
$I->amOnPage('/');
$wp_rest_nonce = $I->grabValueFrom('input[name="rest_nonce"]');
$I->haveHttpHeader('X-WP-Nonce', $wp_rest_nonce);
$I->sendAjaxPostRequest('/wp-json/idlikethis/v1/button-click', ['post_id' => $post_id, 'content' => 'Some Content']);
$I->seeResponseCodeIs(200);
$I->seeCommentInDatabase(['comment_post_ID' => $post_id]);
}
示例7: 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');
}
示例8: _assertExport
/**
* @param FunctionalTester $I
* @param Project $project
* @param array $issues1
* @param array $issues2
*
* @return void
*/
protected function _assertExport(FunctionalTester $I, Project $project, array $issues1, array $issues2)
{
$I->seeResponseCodeIs(200);
array_walk($issues1, function ($issue) use($I) {
$I->see($issue->title);
});
$I->see($project->name);
array_walk($issues2, function ($issue) use($I) {
$I->dontSee($issue->title);
});
}
示例9: 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');
}
示例10: it_should_reset_comments_when_post_id_is_valid
/**
* @test
* it should reset comments when post id is valid
*/
public function it_should_reset_comments_when_post_id_is_valid(\FunctionalTester $I)
{
$post_id = $I->havePostInDatabase();
$comment_ids = $I->haveManyCommentsInDatabase(3, $post_id, ['comment_type' => 'idlikethis']);
$I->loginAsAdmin();
$I->amEditingPostWithId($post_id);
$wp_rest_nonce = $I->grabValueFrom('input[name="rest_nonce"]');
$I->haveHttpHeader('X-WP-Nonce', $wp_rest_nonce);
$I->sendAjaxPostRequest('/wp-json/idlikethis/v1/admin/reset-all', ['post_id' => $post_id]);
$I->seeResponseCodeIs(200);
foreach ($comment_ids as $comment_id) {
$I->dontSeeCommentInDatabase(['comment_ID' => $comment_id, 'comment_post_ID' => $post_id]);
}
}
示例11: it_should_consolidate_comments_when_post_id_is_valid_and_user_can_edit_posts
/**
* @test
* it should consolidate comments when post id is valid and user can edit posts
*/
public function it_should_consolidate_comments_when_post_id_is_valid_and_user_can_edit_posts(\FunctionalTester $I)
{
$post_id = $I->havePostInDatabase();
$comment_ids = $I->haveManyCommentsInDatabase(3, $post_id, ['comment_type' => 'idlikethis', 'comment_content' => '{{n}} - foo']);
$I->loginAsAdmin();
$I->amEditingPostWithId($post_id);
$wp_rest_nonce = $I->grabValueFrom('input[name="rest_nonce"]');
$I->haveHttpHeader('X-WP-Nonce', $wp_rest_nonce);
$I->sendAjaxPostRequest('/wp-json/idlikethis/v1/admin/consolidate-all', ['post_id' => $post_id]);
$I->seeResponseCodeIs(200);
foreach ($comment_ids as $comment_id) {
$I->dontSeeCommentInDatabase(['comment_ID' => $comment_id, 'comment_post_ID' => $post_id]);
}
$I->seePostMetaInDatabase(['post_id' => $post_id, 'meta_key' => '_idlikethis_votes', 'meta_value' => serialize(['foo' => 3])]);
}
示例12: 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);
}
示例13: memberCantAddCash
public function memberCantAddCash(FunctionalTester $I)
{
$I->am('a member');
$I->wantTo('make sure I cant add cash payments to my account');
//Load and login a known member
$user = User::find(1);
Auth::login($user);
//I cant see option
$I->amOnPage('/account/' . $user->id . '');
$I->cantSee('Record a cash balance payment');
//Make sure they cant post payment directly
//Confirm that posting directly generates a validation exception
$I->sendPOST('/account/' . $user->id . '/payment/cash/create', ['reason' => 'balance', 'amount' => 4.69, 'return_path' => '/']);
$I->seeResponseCodeIs(403);
//One final check
$I->cantSeeInDatabase('payments', ['amount' => 4.69]);
}
示例14: 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);
}
示例15: cantEditClosedIssue
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function cantEditClosedIssue(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('not be able to edit closed issue');
$admin = $I->createUser(1, 4);
$developer1 = $I->createUser(2, 2);
// developer
$I->amLoggedAs($admin);
$project = $I->createProject(1, [$developer1]);
$issue = $I->createIssue(1, $admin, $developer1, $project);
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->click('Issue 1', '.edit-issue');
$I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]);
$I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->click(trans('tinyissue.close_issue'), '.close-issue');
$I->seeLink(trans('tinyissue.reopen_issue'));
$I->click('Issue 1', '.edit-issue');
$I->seeResponseCodeIs(200);
$I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
$I->see(trans('tinyissue.cant_edit_closed_issue'));
}