Posts, Post Types: Fix post type templates with child themes.

After [38951] added support for post type templates beyond pages, this fixes an issue where an empty meta box would be shown when using child themes.

Fixes #38696.

git-svn-id: https://develop.svn.wordpress.org/trunk@39168 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2016-11-08 22:40:28 +00:00
parent 4b3e128140
commit 5f610350e1
4 changed files with 39 additions and 2 deletions
@@ -85,4 +85,29 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
), get_page_templates( null, 'post' ) );
$this->assertEquals( array(), get_page_templates( null, 'bar' ) );
}
/**
* @ticket 38696
*/
function test_page_templates_child_theme() {
$theme = wp_get_theme( 'page-templates-child' );
$this->assertNotEmpty( $theme );
switch_theme( $theme['Template'], $theme['Stylesheet'] );
$this->assertEqualSetsWithIndex( array(
'Top Level' => 'template-top-level-post-types.php',
'Sub Dir' => 'subdir/template-sub-dir-post-types.php',
), get_page_templates( null, 'foo' ) );
$this->assertEqualSetsWithIndex( array(
'Top Level' => 'template-top-level-post-types.php',
'Sub Dir' => 'subdir/template-sub-dir-post-types.php',
), get_page_templates( null, 'post' ) );
$this->assertEqualSetsWithIndex( array(
'Top Level' => 'template-top-level.php',
'Sub Dir' => 'subdir/template-sub-dir.php',
'This Template Header Is On One Line' => 'template-header.php',
), get_page_templates() );
$this->assertEquals( array(), get_page_templates( null, 'bar' ) );
}
}