Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tests/phpunit/tests/post/getPostsByAuthorSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
self::$user_id_2 = $factory->user->create();
}

public function tear_down() {
unregister_post_type( 'foo' );
unregister_post_type( 'bar' );
unregister_post_type( 'baz' );

parent::tear_down();
}

public function test_post_type_post() {
$maybe_string = get_posts_by_author_sql( 'post' );
$this->assertStringContainsString( "post_type = 'post'", $maybe_string );
Expand All @@ -51,9 +59,6 @@ public function test_multiple_post_types() {
$maybe_string = get_posts_by_author_sql( array( 'foo', 'bar' ) );
$this->assertStringContainsString( "post_type = 'foo'", $maybe_string );
$this->assertStringContainsString( "post_type = 'bar'", $maybe_string );

_unregister_post_type( 'foo' );
_unregister_post_type( 'bar' );
}

public function test_full_true() {
Expand Down Expand Up @@ -167,9 +172,6 @@ public function test_user_has_access_only_to_private_posts_for_certain_post_type
$this->assertStringNotContainsString( "post_type = 'bar' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );
$this->assertStringContainsString( "post_type = 'baz' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );

_unregister_post_type( 'foo' );
_unregister_post_type( 'bar' );
_unregister_post_type( 'baz' );
wp_set_current_user( $current_user );
}
}
Loading