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
This commit is contained in:
Sergey Biryukov
2021-12-19 16:23:38 +00:00
parent 7c0f7cbbda
commit ef404e2599
11 changed files with 16 additions and 45 deletions

View File

@@ -1,3 +0,0 @@
<?php
echo 'PHP template for page with slug "home"';

View File

@@ -1,4 +0,0 @@
/*
Theme Name: Test Block Child Theme
Template: test-block-theme
*/

View File

@@ -1,3 +0,0 @@
<!-- wp:paragraph -->
<p>Page (ID 1) Template</p>
<!-- /wp:paragraph -->

View File

@@ -1,2 +0,0 @@
<?php
// This file is for test purposes only.

View File

@@ -1,3 +0,0 @@
<?php
echo 'PHP template for page with ID 1';

View File

@@ -1,3 +0,0 @@
/*
Theme Name: Test Block Theme
*/

View File

@@ -1,3 +0,0 @@
<!-- wp:paragraph -->
<p>Index Template</p>
<!-- /wp:paragraph -->

View File

@@ -1,3 +0,0 @@
<!-- wp:paragraph -->
<p>Page (Home) Template</p>
<!-- /wp:paragraph -->

View File

@@ -1,3 +0,0 @@
<!-- wp:paragraph -->
<p>Page Template</p>
<!-- /wp:paragraph -->

View File

@@ -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 );

View File

@@ -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',
),
);
}