Changeset 50401
- Timestamp:
- 02/22/2021 01:21:26 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/embed.php
r50371 r50401 510 510 * @param WP_Post|int $post Post object or ID. 511 511 * @param int $width The requested width. 512 * @return array|false Response data on success, false if post doesn't exist. 512 * @return array|false Response data on success, false if post doesn't exist 513 * or is not publicly viewable. 513 514 */ 514 515 function get_oembed_response_data( $post, $width ) { … … 520 521 } 521 522 522 if ( 'publish' !== get_post_status( $post ) ) {523 if ( ! is_post_publicly_viewable( $post ) ) { 523 524 return false; 524 525 } -
trunk/tests/phpunit/tests/oembed/getResponseData.php
r48939 r50401 3 3 /** 4 4 * @group oembed 5 * @covers ::get_oembed_response_data 5 6 */ 6 7 class Tests_oEmbed_Response_Data extends WP_UnitTestCase { … … 129 130 } 130 131 132 /** 133 * @ticket 47574 134 */ 135 function test_get_oembed_response_data_with_public_true_custom_post_status() { 136 // Custom status with 'public' => true. 137 register_post_status( 'public', array( 'public' => true ) ); 138 139 $post = self::factory()->post->create_and_get( 140 array( 141 'post_status' => 'public', 142 ) 143 ); 144 145 $this->assertNotFalse( get_oembed_response_data( $post, 100 ) ); 146 } 147 148 /** 149 * @ticket 47574 150 */ 151 function test_get_oembed_response_data_with_public_false_custom_post_status() { 152 // Custom status with 'public' => false. 153 register_post_status( 'private_foo', array( 'public' => false ) ); 154 155 $post = self::factory()->post->create_and_get( 156 array( 157 'post_status' => 'private_foo', 158 ) 159 ); 160 161 $this->assertFalse( get_oembed_response_data( $post, 100 ) ); 162 } 163 164 /** 165 * @ticket 47574 166 */ 167 function test_get_oembed_response_data_with_unregistered_custom_post_status() { 168 $post = self::factory()->post->create_and_get( 169 array( 170 'post_status' => 'unknown_foo', 171 ) 172 ); 173 174 $this->assertFalse( get_oembed_response_data( $post, 100 ) ); 175 } 176 131 177 function test_get_oembed_response_data_maxwidth_too_high() { 132 178 $post = self::factory()->post->create_and_get();
Note: See TracChangeset
for help on using the changeset viewer.