Changeset 51462 for trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php
- Timestamp:
- 07/19/2021 02:00:11 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php
r46586 r51462 8 8 public function test_post_type_post() { 9 9 $maybe_string = get_posts_by_author_sql( 'post' ); 10 $this->assert Contains( "post_type = 'post'", $maybe_string );10 $this->assertStringContainsString( "post_type = 'post'", $maybe_string ); 11 11 } 12 12 13 13 public function test_post_type_page() { 14 14 $maybe_string = get_posts_by_author_sql( 'page' ); 15 $this->assert Contains( "post_type = 'page'", $maybe_string );15 $this->assertStringContainsString( "post_type = 'page'", $maybe_string ); 16 16 } 17 17 18 18 public function test_non_existent_post_type() { 19 19 $maybe_string = get_posts_by_author_sql( 'non_existent_post_type' ); 20 $this->assert Contains( '1 = 0', $maybe_string );20 $this->assertStringContainsString( '1 = 0', $maybe_string ); 21 21 } 22 22 … … 26 26 27 27 $maybe_string = get_posts_by_author_sql( array( 'foo', 'bar' ) ); 28 $this->assert Contains( "post_type = 'foo'", $maybe_string );29 $this->assert Contains( "post_type = 'bar'", $maybe_string );28 $this->assertStringContainsString( "post_type = 'foo'", $maybe_string ); 29 $this->assertStringContainsString( "post_type = 'bar'", $maybe_string ); 30 30 31 31 _unregister_post_type( 'foo' ); … … 45 45 public function test_post_type_clause_should_be_included_when_full_is_true() { 46 46 $maybe_string = get_posts_by_author_sql( 'post', true ); 47 $this->assert Contains( "post_type = 'post'", $maybe_string );47 $this->assertStringContainsString( "post_type = 'post'", $maybe_string ); 48 48 } 49 49 50 50 public function test_post_type_clause_should_be_included_when_full_is_false() { 51 51 $maybe_string = get_posts_by_author_sql( 'post', false ); 52 $this->assert Contains( "post_type = 'post'", $maybe_string );52 $this->assertStringContainsString( "post_type = 'post'", $maybe_string ); 53 53 } 54 54 55 55 public function test_post_author_should_create_post_author_clause() { 56 56 $maybe_string = get_posts_by_author_sql( 'post', true, 1 ); 57 $this->assert Contains( 'post_author = 1', $maybe_string );57 $this->assertStringContainsString( 'post_author = 1', $maybe_string ); 58 58 } 59 59 … … 64 64 65 65 $maybe_string = get_posts_by_author_sql( 'post', true, $u, true ); 66 $this->assert NotContains( "post_status = 'private'", $maybe_string );66 $this->assertStringNotContainsString( "post_status = 'private'", $maybe_string ); 67 67 68 68 wp_set_current_user( $current_user ); … … 85 85 86 86 $maybe_string = get_posts_by_author_sql( 'post', true, $u, false ); 87 $this->assert Contains( "post_status = 'private'", $maybe_string );87 $this->assertStringContainsString( "post_status = 'private'", $maybe_string ); 88 88 89 89 wp_set_current_user( $current_user ); … … 97 97 98 98 $maybe_string = get_posts_by_author_sql( 'post', true, $u2, false ); 99 $this->assert NotContains( "post_status = 'private'", $maybe_string );99 $this->assertStringNotContainsString( "post_status = 'private'", $maybe_string ); 100 100 101 101 wp_set_current_user( $current_user ); … … 108 108 109 109 $maybe_string = get_posts_by_author_sql( 'post', true, $u, false ); 110 $this->assert Contains( "post_status = 'private'", $maybe_string );111 $this->assert Contains( "post_author = $u", $maybe_string );110 $this->assertStringContainsString( "post_status = 'private'", $maybe_string ); 111 $this->assertStringContainsString( "post_author = $u", $maybe_string ); 112 112 113 113 wp_set_current_user( $current_user ); … … 120 120 121 121 $maybe_string = get_posts_by_author_sql( 'post', true, null, false ); 122 $this->assert Contains( "post_status = 'private'", $maybe_string );123 $this->assert NotContains( 'post_author', $maybe_string );122 $this->assertStringContainsString( "post_status = 'private'", $maybe_string ); 123 $this->assertStringNotContainsString( 'post_author', $maybe_string ); 124 124 125 125 wp_set_current_user( $current_user ); … … 140 140 $editor_role->remove_cap( 'read_private_baz' ); 141 141 142 $this->assert NotContains( "post_type = 'foo' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );143 $this->assert NotContains( "post_type = 'bar' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );144 $this->assert Contains( "post_type = 'baz' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );142 $this->assertStringNotContainsString( "post_type = 'foo' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string ); 143 $this->assertStringNotContainsString( "post_type = 'bar' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string ); 144 $this->assertStringContainsString( "post_type = 'baz' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string ); 145 145 146 146 _unregister_post_type( 'foo' );
Note: See TracChangeset
for help on using the changeset viewer.