本文整理汇总了PHP中FunctionalTester::haveHttpHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::haveHttpHeader方法的具体用法?PHP FunctionalTester::haveHttpHeader怎么用?PHP FunctionalTester::haveHttpHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::haveHttpHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NotGetting500
public function NotGetting500(Tester $I)
{
$I->wantToTest('whether we are getting any 500 error');
$I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
$I->sendGET("currenttime", ["source" => $this->apiInfo[Helper::CSV_ORDER_SOURCE]]);
$I->dontSeeResponseCodeIs(500);
}
示例2: 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]);
}
示例3: 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]);
}
}
示例4: 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])]);
}
示例5: _before
public function _before(FunctionalTester $I)
{
Artisan::call('db:truncate');
$I->haveHttpHeader('Accept', 'application/json');
}
示例6: OtherVerb
public function OtherVerb(Tester $I)
{
$time = time();
$I->wantTo('Test invalid Verb');
$I->haveHttpHeader("apikey", $this->apikey);
$I->haveHttpHeader("timestamp", $time);
$I->haveHttpHeader("fingerprint", Helper::createFingerPrint($this->apikey, $this->secret, $time, 'POST', $this->resourceURL, $this->nric, $this->amount, $this->date, $this->source));
$I->haveHttpHeader("Content-Type", 'application/x-www-form-urlencoded');
$I->sendOPTIONS("updates", Helper::assemblePostData($this->nric, $this->amount, $this->date, $this->source));
$I->seeResponseCodeIs(405);
}