From 0940f8396ce8ad9903d2d06ea29b2592af9426d6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 29 Apr 2017 21:15:34 +0000 Subject: [PATCH] Posts, Post Types: Correct the attachment post type template unit test introduced in [38951]. Also adds additional assertions for the templates. See #18375 git-svn-id: https://develop.svn.wordpress.org/trunk@40558 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/template.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/template.php b/tests/phpunit/tests/template.php index fe5ecfee0d..4b9bec5084 100644 --- a/tests/phpunit/tests/template.php +++ b/tests/phpunit/tests/template.php @@ -194,6 +194,7 @@ class Tests_Template extends WP_UnitTestCase { } public function test_page_template_hierarchy() { + $this->assertEquals( 'templates/page.php', get_page_template_slug( self::$page ) ); $this->assertTemplateHierarchy( get_permalink( self::$page ), array( 'templates/page.php', 'page-page-name-😀.php', @@ -208,6 +209,7 @@ class Tests_Template extends WP_UnitTestCase { * @ticket 18375 */ public function test_single_template_hierarchy_for_post() { + $this->assertEquals( 'templates/post.php', get_page_template_slug( self::$post ) ); $this->assertTemplateHierarchy( get_permalink( self::$post ), array( 'templates/post.php', 'single-post-post-name-😀.php', @@ -243,6 +245,7 @@ class Tests_Template extends WP_UnitTestCase { ) ); add_post_meta( $cpt->ID, '_wp_page_template', 'templates/cpt.php' ); + $this->assertEquals( 'templates/cpt.php', get_page_template_slug( $cpt ) ); $this->assertTemplateHierarchy( get_permalink( $cpt ), array( 'templates/cpt.php', 'single-cpt-cpt-name-😀.php', @@ -282,9 +285,11 @@ class Tests_Template extends WP_UnitTestCase { 'post_mime_type' => 'image/jpeg', ) ); - add_post_meta( $attachment, '_wp_page_template', 'templates/cpt.php' ); + add_post_meta( $attachment->ID, '_wp_page_template', 'templates/attachment.php' ); + $this->assertEquals( 'templates/attachment.php', get_page_template_slug( $attachment ) ); $this->assertTemplateHierarchy( get_permalink( $attachment ), array( + 'templates/attachment.php', 'image-jpeg.php', 'jpeg.php', 'image.php',