From ef404e2599b7e9ff0a9568d0f7348731e89f5f14 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 19 Dec 2021 16:23:38 +0000 Subject: [PATCH] Tests: Use shared fixtures in block theme tests. This removes duplicate test data and aims to avoid future confusion about which themes to use in which tests. Follow-up to [52049], [52246], [52247], [52279]. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@52391 602fd350-edb4-49c9-b593-d223f7449a82 --- .../test-block-child-theme/page-home.php | 3 -- .../test-block-child-theme/style.css | 4 --- .../templates/page-1.html | 3 -- .../data/themedir1/test-block-theme/index.php | 2 -- .../themedir1/test-block-theme/page-1.php | 3 -- .../data/themedir1/test-block-theme/style.css | 3 -- .../test-block-theme/templates/index.html | 3 -- .../test-block-theme/templates/page-home.html | 3 -- .../test-block-theme/templates/page.html | 3 -- tests/phpunit/tests/theme/themeDir.php | 2 -- tests/phpunit/tests/theme/wpTheme.php | 32 +++++++++---------- 11 files changed, 16 insertions(+), 45 deletions(-) delete mode 100644 tests/phpunit/data/themedir1/test-block-child-theme/page-home.php delete mode 100644 tests/phpunit/data/themedir1/test-block-child-theme/style.css delete mode 100644 tests/phpunit/data/themedir1/test-block-child-theme/templates/page-1.html delete mode 100644 tests/phpunit/data/themedir1/test-block-theme/index.php delete mode 100644 tests/phpunit/data/themedir1/test-block-theme/page-1.php delete mode 100644 tests/phpunit/data/themedir1/test-block-theme/style.css delete mode 100644 tests/phpunit/data/themedir1/test-block-theme/templates/index.html delete mode 100644 tests/phpunit/data/themedir1/test-block-theme/templates/page-home.html delete mode 100644 tests/phpunit/data/themedir1/test-block-theme/templates/page.html diff --git a/tests/phpunit/data/themedir1/test-block-child-theme/page-home.php b/tests/phpunit/data/themedir1/test-block-child-theme/page-home.php deleted file mode 100644 index 86efe80db6..0000000000 --- a/tests/phpunit/data/themedir1/test-block-child-theme/page-home.php +++ /dev/null @@ -1,3 +0,0 @@ - -

Page (ID 1) Template

- \ No newline at end of file diff --git a/tests/phpunit/data/themedir1/test-block-theme/index.php b/tests/phpunit/data/themedir1/test-block-theme/index.php deleted file mode 100644 index 634710b208..0000000000 --- a/tests/phpunit/data/themedir1/test-block-theme/index.php +++ /dev/null @@ -1,2 +0,0 @@ - -

Index Template

- \ No newline at end of file diff --git a/tests/phpunit/data/themedir1/test-block-theme/templates/page-home.html b/tests/phpunit/data/themedir1/test-block-theme/templates/page-home.html deleted file mode 100644 index 6be0c70fb2..0000000000 --- a/tests/phpunit/data/themedir1/test-block-theme/templates/page-home.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Page (Home) Template

- \ No newline at end of file diff --git a/tests/phpunit/data/themedir1/test-block-theme/templates/page.html b/tests/phpunit/data/themedir1/test-block-theme/templates/page.html deleted file mode 100644 index 61c493e1bd..0000000000 --- a/tests/phpunit/data/themedir1/test-block-theme/templates/page.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Page Template

- \ No newline at end of file diff --git a/tests/phpunit/tests/theme/themeDir.php b/tests/phpunit/tests/theme/themeDir.php index 5255037866..9311f6643a 100644 --- a/tests/phpunit/tests/theme/themeDir.php +++ b/tests/phpunit/tests/theme/themeDir.php @@ -163,8 +163,6 @@ class Tests_Theme_ThemeDir extends WP_UnitTestCase { 'REST Theme', 'Block Theme', 'Block Theme Child Theme', - 'Test Block Theme', - 'Test Block Child Theme', ); sort( $theme_names ); diff --git a/tests/phpunit/tests/theme/wpTheme.php b/tests/phpunit/tests/theme/wpTheme.php index 20e960bf3e..3fb1e6e4b7 100644 --- a/tests/phpunit/tests/theme/wpTheme.php +++ b/tests/phpunit/tests/theme/wpTheme.php @@ -273,11 +273,11 @@ class Tests_Theme_wpTheme extends WP_UnitTestCase { 'expected' => false, ), 'parent block theme' => array( - 'theme_dir' => 'test-block-theme', + 'theme_dir' => 'block-theme', 'expected' => true, ), 'child block theme' => array( - 'theme_dir' => 'test-block-child-theme', + 'theme_dir' => 'block-theme-child', 'expected' => true, ), ); @@ -312,14 +312,14 @@ class Tests_Theme_wpTheme extends WP_UnitTestCase { 'expected' => '/nonexistent', ), 'parent theme: no file given' => array( - 'theme_dir' => 'test-block-theme', + 'theme_dir' => 'block-theme', 'file' => '', - 'expected' => '/test-block-theme', + 'expected' => '/block-theme', ), 'child theme: no file given' => array( - 'theme_dir' => 'test-block-child-theme', + 'theme_dir' => 'block-theme-child', 'file' => '', - 'expected' => '/test-block-child-theme', + 'expected' => '/block-theme-child', ), 'nonexistent theme: file given' => array( 'theme_dir' => 'nonexistent', @@ -327,29 +327,29 @@ class Tests_Theme_wpTheme extends WP_UnitTestCase { 'expected' => '/nonexistent/templates/page.html', ), 'parent theme: file exists' => array( - 'theme_dir' => 'test-block-theme', + 'theme_dir' => 'block-theme', 'file' => '/templates/page-home.html', - 'expected' => '/test-block-theme/templates/page-home.html', + 'expected' => '/block-theme/templates/page-home.html', ), 'parent theme: file does not exist' => array( - 'theme_dir' => 'test-block-theme', + 'theme_dir' => 'block-theme', 'file' => '/templates/nonexistent.html', - 'expected' => '/test-block-theme/templates/nonexistent.html', + 'expected' => '/block-theme/templates/nonexistent.html', ), 'child theme: file exists' => array( - 'theme_dir' => 'test-block-child-theme', + 'theme_dir' => 'block-theme-child', 'file' => '/templates/page-1.html', - 'expected' => '/test-block-child-theme/templates/page-1.html', + 'expected' => '/block-theme-child/templates/page-1.html', ), 'child theme: file does not exist' => array( - 'theme_dir' => 'test-block-child-theme', + 'theme_dir' => 'block-theme-child', 'file' => '/templates/nonexistent.html', - 'expected' => '/test-block-theme/templates/nonexistent.html', + 'expected' => '/block-theme/templates/nonexistent.html', ), 'child theme: file exists in parent, not in child' => array( - 'theme_dir' => 'test-block-child-theme', + 'theme_dir' => 'block-theme-child', 'file' => '/templates/page.html', - 'expected' => '/test-block-theme/templates/page.html', + 'expected' => '/block-theme/templates/page.html', ), ); }