mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 07:36:58 +00:00
Code is Poetry.
WordPress' code just... wasn't. This is now dealt with. Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS. Fixes #41057. git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -19,12 +19,19 @@ class Tests_oEmbed_Discovery extends WP_UnitTestCase {
|
||||
*/
|
||||
function test_add_oembed_discovery_links_static_front_page() {
|
||||
update_option( 'show_on_front', 'page' );
|
||||
update_option( 'page_on_front', self::factory()->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
|
||||
update_option(
|
||||
'page_on_front', self::factory()->post->create(
|
||||
array(
|
||||
'post_title' => 'front-page',
|
||||
'post_type' => 'page',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->go_to( home_url() );
|
||||
$this->assertQueryTrue( 'is_front_page', 'is_singular', 'is_page' );
|
||||
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
|
||||
|
||||
$this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
|
||||
@@ -37,20 +44,22 @@ class Tests_oEmbed_Discovery extends WP_UnitTestCase {
|
||||
$this->go_to( get_permalink( $post_id ) );
|
||||
$this->assertQueryTrue( 'is_single', 'is_singular' );
|
||||
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
|
||||
|
||||
$this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
|
||||
}
|
||||
|
||||
function test_add_oembed_discovery_links_to_page() {
|
||||
$post_id = self::factory()->post->create( array(
|
||||
'post_type' => 'page'
|
||||
));
|
||||
$post_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
)
|
||||
);
|
||||
$this->go_to( get_permalink( $post_id ) );
|
||||
$this->assertQueryTrue( 'is_page', 'is_singular' );
|
||||
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
|
||||
|
||||
$this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
|
||||
@@ -59,14 +68,16 @@ class Tests_oEmbed_Discovery extends WP_UnitTestCase {
|
||||
function test_add_oembed_discovery_links_to_attachment() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$file = DIR_TESTDATA . '/images/canola.jpg';
|
||||
$attachment_id = self::factory()->attachment->create_object( $file, $post_id, array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
) );
|
||||
$attachment_id = self::factory()->attachment->create_object(
|
||||
$file, $post_id, array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
)
|
||||
);
|
||||
|
||||
$this->go_to( get_permalink( $attachment_id ) );
|
||||
$this->assertQueryTrue( 'is_attachment', 'is_singular', 'is_single' );
|
||||
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
$expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
|
||||
|
||||
$this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
|
||||
|
||||
Reference in New Issue
Block a user