diff --git a/tests/phpunit/data/languages/themes/fse-pl_PL.mo b/tests/phpunit/data/languages/themes/fse-pl_PL.mo new file mode 100644 index 0000000000..0ff620e64a Binary files /dev/null and b/tests/phpunit/data/languages/themes/fse-pl_PL.mo differ diff --git a/tests/phpunit/tests/blocks/data/languages/themes/fse-pl_PL.po b/tests/phpunit/data/languages/themes/fse-pl_PL.po similarity index 100% rename from tests/phpunit/tests/blocks/data/languages/themes/fse-pl_PL.po rename to tests/phpunit/data/languages/themes/fse-pl_PL.po diff --git a/tests/phpunit/data/themedir1/fse/index.php b/tests/phpunit/data/themedir1/fse/index.php new file mode 100644 index 0000000000..c674182076 --- /dev/null +++ b/tests/phpunit/data/themedir1/fse/index.php @@ -0,0 +1,4 @@ +theme_root = realpath( __DIR__ . '/data/themedir1' ); + $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' ); $this->orig_theme_dir = $GLOBALS['wp_theme_directories']; @@ -40,6 +41,9 @@ class WP_Theme_JSON_Resolver_Test extends WP_UnitTestCase { return 'pl_PL'; } + /** + * @ticket 52991 + */ function test_fields_are_extracted() { $actual = WP_Theme_JSON_Resolver::get_fields_to_translate(); @@ -84,9 +88,12 @@ class WP_Theme_JSON_Resolver_Test extends WP_UnitTestCase { $this->assertEquals( $expected, $actual ); } + /** + * @ticket 52991 + */ function test_translations_are_applied() { add_filter( 'locale', array( $this, 'filter_set_locale_to_polish' ) ); - load_textdomain( 'fse', realpath( __DIR__ . '/data/languages/themes/fse-pl_PL.mo' ) ); + load_textdomain( 'fse', realpath( DIR_TESTDATA . '/languages/themes/fse-pl_PL.mo' ) ); switch_theme( 'fse' ); @@ -131,6 +138,9 @@ class WP_Theme_JSON_Resolver_Test extends WP_UnitTestCase { ); } + /** + * @ticket 52991 + */ function test_switching_themes_recalculates_data() { // By default, the theme for unit tests is "default", // which doesn't have theme.json support. diff --git a/tests/phpunit/tests/blocks/class-wp-theme-json-test.php b/tests/phpunit/tests/theme/class-wp-theme-json.php similarity index 97% rename from tests/phpunit/tests/blocks/class-wp-theme-json-test.php rename to tests/phpunit/tests/theme/class-wp-theme-json.php index 0f338e061a..b981bd798e 100644 --- a/tests/phpunit/tests/blocks/class-wp-theme-json-test.php +++ b/tests/phpunit/tests/theme/class-wp-theme-json.php @@ -3,11 +3,15 @@ /** * Test WP_Theme_JSON class. * - * @package Gutenberg + * @package WordPress + * @since 5.8.0 */ class WP_Theme_JSON_Test extends WP_UnitTestCase { + /** + * @ticket 52991 + */ function test_get_settings() { $theme_json = new WP_Theme_JSON( array( @@ -52,6 +56,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual ); } + /** + * @ticket 52991 + */ public function test_merge_incoming_data() { $initial = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA, @@ -259,6 +266,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual ); } + /** + * @ticket 52991 + */ function test_get_from_editor_settings() { $input = array( 'disableCustomColors' => true, @@ -332,6 +342,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual ); } + /** + * @ticket 52991 + */ function test_get_editor_settings_no_theme_support() { $input = array( '__unstableEnableFullSiteEditingBlocks' => false, @@ -384,6 +397,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual ); } + /** + * @ticket 52991 + */ function test_get_editor_settings_blank() { $expected = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA, @@ -394,6 +410,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual ); } + /** + * @ticket 52991 + */ function test_get_editor_settings_custom_units_can_be_disabled() { add_theme_support( 'custom-units', array() ); $input = get_default_block_editor_settings(); @@ -408,6 +427,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual['settings']['spacing'] ); } + /** + * @ticket 52991 + */ function test_get_editor_settings_custom_units_can_be_enabled() { add_theme_support( 'custom-units' ); $input = get_default_block_editor_settings(); @@ -422,6 +444,9 @@ class WP_Theme_JSON_Test extends WP_UnitTestCase { $this->assertEqualSetsWithIndex( $expected, $actual['settings']['spacing'] ); } + /** + * @ticket 52991 + */ function test_get_editor_settings_custom_units_can_be_filtered() { add_theme_support( 'custom-units', 'rem', 'em' ); $input = get_default_block_editor_settings(); diff --git a/tests/phpunit/tests/theme/themeDir.php b/tests/phpunit/tests/theme/themeDir.php index b2a2542895..b7dc139521 100644 --- a/tests/phpunit/tests/theme/themeDir.php +++ b/tests/phpunit/tests/theme/themeDir.php @@ -161,6 +161,7 @@ class Tests_Theme_ThemeDir extends WP_UnitTestCase { 'Internationalized Theme', 'camelCase', 'REST Theme', + 'FSE Theme', ); sort( $theme_names );