Changeset 37732
- Timestamp:
- 06/16/2016 05:29:51 PM (8 years ago)
- Location:
- branches/4.5
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.5
-
branches/4.5/src/wp-includes/embed.php
r37709 r37732 1101 1101 $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); 1102 1102 1103 if ( ! $post_id ) { 1104 return $result; 1105 } 1106 1103 1107 $width = isset( $args['width'] ) ? $args['width'] : 0; 1104 1108 -
branches/4.5/tests/phpunit/tests/oembed/wpOembed.php
r37711 r37732 25 25 $this->pre_oembed_result_filtered = $result; 26 26 27 return $result; 27 // Return false to prevent HTTP requests during tests. 28 return $result ? $result : false; 28 29 } 29 30 … … 54 55 $this->assertEquals( $this->pre_oembed_result_filtered, $actual ); 55 56 } 57 58 public function test_wp_filter_pre_oembed_result_non_existent_post() { 59 $post_id = self::factory()->post->create(); 60 $permalink = get_permalink( $post_id ); 61 62 $this->go_to( $permalink ); 63 $this->assertQueryTrue( 'is_single', 'is_singular' ); 64 65 add_filter( 'pre_oembed_result', array( $this, '_filter_pre_oembed_result' ) ); 66 $actual = $this->oembed->get_html( 'https://example.com/' ); 67 remove_filter( 'pre_oembed_result', array( $this, '_filter_pre_oembed_result' ) ); 68 69 $this->assertTrue( false !== $this->pre_oembed_result_filtered ); 70 $this->assertFalse( $actual ); 71 } 56 72 }
Note: See TracChangeset
for help on using the changeset viewer.