Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix phpunit failures #51950

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions phpunit/block-template-utils-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
public function set_up() {
parent::set_up();
switch_theme( 'emptytheme' );
}

public static function wpSetUpBeforeClass() {
register_post_type(
'custom_book',
array(
Expand All @@ -22,9 +19,10 @@ public static function wpSetUpBeforeClass() {
register_taxonomy( 'book_type', 'custom_book' );
}

public static function wpTearDownAfterClass() {
public function tear_down() {
unregister_post_type( 'custom_book' );
unregister_taxonomy( 'book_type' );
parent::tear_down();
}

public function test_get_template_hierarchy() {
Expand Down
6 changes: 6 additions & 0 deletions phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
define( 'LOCAL_WP_ENVIRONMENT_TYPE', 'local' );
}

// Pretend that these are Core unit tests. This is needed so that
// wp_theme_has_theme_json() does not cache its return value between each test.
if ( ! defined( 'WP_RUN_CORE_TESTS' ) ) {
noisysocks marked this conversation as resolved.
Show resolved Hide resolved
define( 'WP_RUN_CORE_TESTS', true );
}

// Require composer dependencies.
require_once dirname( __DIR__ ) . '/vendor/autoload.php';

Expand Down