本文整理汇总了PHP中FunctionalTester::havePostInDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::havePostInDatabase方法的具体用法?PHP FunctionalTester::havePostInDatabase怎么用?PHP FunctionalTester::havePostInDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::havePostInDatabase方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_should_render_extended_shortcode
/**
* @test
* it should render extended shortcode
*/
public function it_should_render_extended_shortcode(\FunctionalTester $I)
{
$content = 'Lorem ipsum [idlikethis]Some idea of mine[/idlikethis]';
$post_id = $I->havePostInDatabase(['post_name' => 'foo', 'post_content' => $content]);
$I->amOnPage('/foo');
$text = "Some idea of mine";
$I->seeElement('.idlikethis-button[data-post-id="' . $post_id . '"][data-text="' . $text . '"] button');
}
示例2: it_should_create_missing_terms_assigned_to_post
/**
* @test
* it should create missing terms assigned to post
*/
public function it_should_create_missing_terms_assigned_to_post(FunctionalTester $I)
{
$postId = $I->havePostInDatabase(['terms' => ['taxonomy_two' => ['term_one']]]);
$termId = $I->grabTermIdFromDatabase(['name' => 'term_one']);
$termTaxonomyId = $I->grabTermTaxonomyIdFromDatabase(['term_id' => $termId, 'taxonomy' => 'taxonomy_two']);
$I->seeInDatabase($I->grabTermRelationshipsTableName(), ['object_id' => $postId, 'term_taxonomy_id' => $termTaxonomyId, 'term_order' => 0]);
$I->seeInDatabase($I->grabTermTaxonomyTableName(), ['term_taxonomy_id' => $termTaxonomyId, 'taxonomy' => 'taxonomy_two', 'count' => 1]);
}
示例3: it_should_delete_posts
public function it_should_delete_posts(FunctionalTester $I)
{
$I->wantTo('delete a post');
$table = 'wp_posts';
$I->havePostInDatabase(13);
$I->seeInDatabase($table, ['ID' => 13]);
$I->dontHavePostInDatabase(['ID' => 13]);
$I->dontSeeInDatabase($table, ['ID' => 13]);
}
示例4: 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]);
}
示例5: 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]);
}
}
示例6: 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])]);
}
示例7: it_should_allow_not_having_comment_in_database
/**
* @test
* it should allow not having comment in database
*/
public function it_should_allow_not_having_comment_in_database(FunctionalTester $I)
{
$postId = $I->havePostInDatabase();
$commentId = $I->haveCommentInDatabase($postId);
$I->seeCommentInDatabase(['comment_ID' => $commentId]);
$I->dontHaveCommentInDatabase(['comment_ID' => $commentId]);
$I->dontSeeCommentInDatabase(['comment_ID' => $commentId]);
}
示例8: it_should_allow_inserting_post_meta_when_inserting_a_post_using_meta_input
/**
* @test
* it should allow inserting post meta when inserting a post using meta input
*/
public function it_should_allow_inserting_post_meta_when_inserting_a_post_using_meta_input(FunctionalTester $I)
{
$meta = ['one' => 'meta one', 'two' => 'meta two'];
$id = $I->havePostInDatabase(['meta_input' => $meta]);
$I->seeInDatabase($I->grabPostsTableName(), ['ID' => $id]);
foreach ($meta as $meta_key => $meta_value) {
$I->seeInDatabase($I->grabPostmetaTableName(), ['post_id' => $id, 'meta_key' => $meta_key, 'meta_value' => $meta_value]);
}
}
示例9: it_should_serialize_meta_value_when_adding_array_post_meta
/**
* @test
* it should serialize meta value when adding array post meta
*/
public function it_should_serialize_meta_value_when_adding_array_post_meta(FunctionalTester $I)
{
$id = $I->havePostInDatabase();
$meta = ['one', 'two', 'three'];
$I->havePostmetaInDatabase($id, 'foo', $meta);
$I->seeInDatabase($I->grabPostmetaTableName(), ['post_id' => $id, 'meta_key' => 'foo', 'meta_value' => serialize($meta)]);
}