mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Themes: Better names for WP_Theme::is_block_theme() and wp_is_block_theme() and make wp_is_block_theme() a wrapper.
This commit renames the following method and function to better represent block theme terminology: * `WP_Theme::is_block_based()` to `WP_Theme::is_block_theme()` * `wp_is_block_template_theme()` to `wp_is_block_theme()` It also changes `wp_is_block_theme()` to be a helper wrapper (sugar syntax) for `wp_get_theme()->is_block_theme();`. Why? To ensure both the method and function behave the same, to help Gutenberg maintain WordPress cross-version compatibility, and to make it less cumbersome to port changes from Gutenberg to Core. Follow-up to [52069], [52247], [52279]. Props antonvlasenko, costdev, hellofromTonya, noisysocks. Fixes #54550. git-svn-id: https://develop.svn.wordpress.org/trunk@52330 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -248,23 +248,17 @@ class Tests_Theme_wpTheme extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_is_block_based
|
||||
* @dataProvider data_is_block_theme
|
||||
* @ticket 54460
|
||||
*
|
||||
* @covers WP_Theme::is_block_based
|
||||
* @covers WP_Theme::is_block_theme
|
||||
*
|
||||
* @param string $theme_dir Directory of the theme to test.
|
||||
* @param bool $expected Expected result.
|
||||
*/
|
||||
public function test_is_block_based( $theme_dir, $expected ) {
|
||||
$theme = new WP_Theme( $theme_dir, $this->theme_root );
|
||||
$actual = $theme->is_block_based();
|
||||
|
||||
if ( $expected ) {
|
||||
$this->assertTrue( $actual );
|
||||
} else {
|
||||
$this->assertFalse( $actual );
|
||||
}
|
||||
public function test_is_block_theme( $theme_dir, $expected ) {
|
||||
$theme = new WP_Theme( $theme_dir, $this->theme_root );
|
||||
$this->assertSame( $expected, $theme->is_block_theme() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,7 +266,7 @@ class Tests_Theme_wpTheme extends WP_UnitTestCase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data_is_block_based() {
|
||||
public function data_is_block_theme() {
|
||||
return array(
|
||||
'default - non-block theme' => array(
|
||||
'theme_dir' => 'default',
|
||||
|
||||
Reference in New Issue
Block a user