Changeset 35436 for trunk/tests/phpunit/tests/oembed/discovery.php
- Timestamp:
- 10/29/2015 10:50:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/oembed/discovery.php
r35242 r35436 6 6 class Tests_oEmbed_Discovery extends WP_UnitTestCase { 7 7 function test_add_oembed_discovery_links_non_singular() { 8 ob_start(); 9 wp_oembed_add_discovery_links(); 10 $actual = ob_get_clean(); 11 $this->assertSame( '', $actual ); 8 $this->assertSame( '', get_echo( 'wp_oembed_add_discovery_links' ) ); 12 9 } 13 10 … … 15 12 $post_id = self::factory()->post->create(); 16 13 $this->go_to( get_permalink( $post_id ) ); 17 18 14 $this->assertQueryTrue( 'is_single', 'is_singular' ); 19 20 ob_start();21 wp_oembed_add_discovery_links();22 $actual = ob_get_clean();23 15 24 16 $expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n"; 25 17 $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n"; 26 18 27 $this->assertEquals( $expected, $actual);19 $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) ); 28 20 } 29 21 … … 33 25 )); 34 26 $this->go_to( get_permalink( $post_id ) ); 35 36 27 $this->assertQueryTrue( 'is_page', 'is_singular' ); 37 38 ob_start();39 wp_oembed_add_discovery_links();40 $actual = ob_get_clean();41 28 42 29 $expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n"; 43 30 $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n"; 44 31 45 $this->assertEquals( $expected, $actual);32 $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) ); 46 33 } 47 34 … … 54 41 55 42 $this->go_to( get_permalink( $attachment_id ) ); 56 57 43 $this->assertQueryTrue( 'is_attachment', 'is_singular', 'is_single' ); 58 59 ob_start();60 wp_oembed_add_discovery_links();61 $actual = ob_get_clean();62 44 63 45 $expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n"; 64 46 $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n"; 65 47 66 $this->assertEquals( $expected, $actual);48 $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) ); 67 49 } 68 50 }
Note: See TracChangeset
for help on using the changeset viewer.