Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/phpunit/tests/fonts/font-face/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static function set_up_before_class() {
public static function tear_down_after_class() {
// Reset static flags.
self::$requires_switch_theme_fixtures = false;
self::$theme_root = null;

parent::tear_down_after_class();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class Tests_Fonts_WpPrintFontFacesFromStyleVariations extends WP_Font_Face_UnitT
const FONTS_THEME = 'fonts-block-theme';

public static function set_up_before_class() {
parent::set_up_before_class();
self::$requires_switch_theme_fixtures = true;

parent::set_up_before_class();
}

/**
Expand Down
24 changes: 15 additions & 9 deletions tests/phpunit/tests/rest-api/rest-block-type-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public static function wpTearDownAfterClass() {
self::delete_user( self::$admin_id );
self::delete_user( self::$subscriber_id );
unregister_block_type( 'fake/test' );
unregister_block_type( 'fake/invalid' );
unregister_block_type( 'fake/false' );
}

/**
Expand Down Expand Up @@ -138,7 +136,8 @@ public function test_get_item_with_styles() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_name );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_name );
$data = $response->get_data();
$this->assertSameSets( array( $block_styles ), $data['styles'] );
}

Expand Down Expand Up @@ -166,6 +165,7 @@ public function test_get_item_with_styles_merge() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_name );
$response = rest_get_server()->dispatch( $request );
unregister_block_type( $block_name );
$data = $response->get_data();
$expected = array(
array(
Expand Down Expand Up @@ -232,7 +232,8 @@ public function test_get_item_invalid() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_type );
$data = $response->get_data();
$this->assertSame( $block_type, $data['name'] );
$this->assertSame( '1', $data['title'] );
$this->assertNull( $data['category'] );
Expand Down Expand Up @@ -311,7 +312,8 @@ public function test_get_item_defaults() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_type );
$data = $response->get_data();
$this->assertSame( $block_type, $data['name'] );
$this->assertSame( '', $data['title'] );
$this->assertNull( $data['category'] );
Expand Down Expand Up @@ -368,7 +370,8 @@ public function test_get_item_deprecated() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_type );
$data = $response->get_data();
$this->assertSameSets(
array( 'hello_world' ),
$data['editor_script_handles'],
Expand Down Expand Up @@ -438,7 +441,8 @@ public function test_get_item_deprecated_with_arrays() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_type );
$data = $response->get_data();
$this->assertSameSets(
$settings['editor_script'],
$data['editor_script_handles'],
Expand Down Expand Up @@ -525,7 +529,8 @@ public function test_get_variation() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_type );
$data = $response->get_data();
$this->assertSame( $block_type, $data['name'] );
$this->assertArrayHasKey( 'variations', $data );
$this->assertCount( 1, $data['variations'] );
Expand Down Expand Up @@ -868,7 +873,8 @@ public function test_variation_callback() {
wp_set_current_user( self::$admin_id );
$request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
unregister_block_type( $block_type );
$data = $response->get_data();
$this->assertSameSets( $this->mock_variation_callback(), $data['variations'] );
}

Expand Down
10 changes: 5 additions & 5 deletions tests/phpunit/tests/sitemaps/sitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,17 @@ public function test_sitemaps_enabled() {

/**
* @ticket 50643
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function test_disable_sitemap_should_return_404() {
add_filter( 'wp_sitemaps_enabled', '__return_false' );

// Instantiate the server before navigating: registering the sitemap
// rewrite tags is what adds `sitemap` to `$wp->public_query_vars`.
$sitemaps = wp_sitemaps_get_server();

$this->go_to( home_url( '/?sitemap=index' ) );

wp_sitemaps_get_server()->render_sitemaps();
$sitemaps->render_sitemaps();

remove_filter( 'wp_sitemaps_enabled', '__return_false' );

Expand All @@ -481,8 +483,6 @@ public function test_disable_sitemap_should_return_404() {

/**
* @ticket 50643
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function test_empty_url_list_should_return_404() {
wp_register_sitemap_provider( 'foo', new WP_Sitemaps_Empty_Test_Provider( 'foo' ) );
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/tests/widgets/wpWidgetMediaAudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ public function test_enqueue_admin_scripts() {
* @covers WP_Widget_Media_Audio::render_control_template_scripts
*/
public function test_render_control_template_scripts() {
// Provides wp_underscore_audio_template(), normally loaded by wp_enqueue_media().
require_once ABSPATH . WPINC . '/media-template.php';

$widget = new WP_Widget_Media_Audio();

ob_start();
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/tests/widgets/wpWidgetMediaVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ public function test_enqueue_admin_scripts() {
* @covers WP_Widget_Media_Video::render_control_template_scripts
*/
public function test_render_control_template_scripts() {
// Provides wp_underscore_video_template(), normally loaded by wp_enqueue_media().
require_once ABSPATH . WPINC . '/media-template.php';

$widget = new WP_Widget_Media_Video();

ob_start();
Expand Down
Loading