mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
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:
@@ -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' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user