Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions lib/compat/plugin/media.php

This file was deleted.

3 changes: 0 additions & 3 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-7.0/kses.php';
require __DIR__ . '/compat/wordpress-7.0/media.php';

// Gutenberg plugin compat: disable client-side media processing by default.
require __DIR__ . '/compat/plugin/media.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
require __DIR__ . '/experimental/blocks.php';
Expand Down
5 changes: 0 additions & 5 deletions phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ function fail_if_died( $message ) {
// Enable the widget block editor.
tests_add_filter( 'gutenberg_use_widgets_block_editor', '__return_true' );

// Enable client-side media processing for tests.
// The Gutenberg plugin disables this by default (lib/compat/plugin/media.php),
// but tests need the media functions to be loaded.
tests_add_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );

// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';

Expand Down
29 changes: 9 additions & 20 deletions phpunit/media/media-processing-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,31 +202,23 @@ public function test_gutenberg_override_media_templates(): void {
}

/**
* Tests that client-side media processing is disabled by default in the Gutenberg plugin.
*
* The core compat layer defaults to true, but the Gutenberg plugin
* adds a filter to disable it by default (lib/compat/plugin/media.php)
* until known issues are resolved.
* Tests that client-side media processing is enabled by default in the Gutenberg plugin.
*
* @covers ::gutenberg_is_client_side_media_processing_enabled
*/
public function test_client_side_media_processing_disabled_by_default_in_plugin() {
// Remove the test bootstrap override to check the plugin's actual default.
remove_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
$enabled = gutenberg_is_client_side_media_processing_enabled();
// Restore the test bootstrap override.
add_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );

$this->assertFalse( $enabled );
public function test_client_side_media_processing_enabled_by_default_in_plugin() {
$this->assertTrue( gutenberg_is_client_side_media_processing_enabled() );
}

/**
* Tests that client-side media processing can be enabled via filter.
* Tests that client-side media processing can be disabled via filter.
*
* @covers ::gutenberg_is_client_side_media_processing_enabled
*/
public function test_client_side_media_processing_can_be_enabled() {
$this->assertTrue( gutenberg_is_client_side_media_processing_enabled() );
public function test_client_side_media_processing_can_be_disabled_via_filter() {
add_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
$this->assertFalse( gutenberg_is_client_side_media_processing_enabled() );
remove_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
}

/**
Expand All @@ -235,14 +227,11 @@ public function test_client_side_media_processing_can_be_enabled() {
* @covers ::gutenberg_override_attachments_rest_controller
*/
public function test_compat_rest_controller_used_when_filter_disabled() {
// Remove the test bootstrap override so the disable filter takes effect.
remove_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
add_filter( 'wp_client_side_media_processing_enabled', '__return_false' );

$result = gutenberg_override_attachments_rest_controller( array(), 'attachment' );

remove_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
add_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );

$this->assertSame(
array( 'rest_controller_class' => 'Gutenberg_REST_Attachments_Controller_6_9' ),
Expand All @@ -256,7 +245,7 @@ public function test_compat_rest_controller_used_when_filter_disabled() {
* @covers ::gutenberg_override_attachments_rest_controller
*/
public function test_compat_rest_controller_not_used_when_filter_enabled() {
// Feature is enabled via test bootstrap filter at priority 20.
// Feature is enabled by default (core compat layer).
$result = gutenberg_override_attachments_rest_controller( array(), 'attachment' );

$this->assertSame( array(), $result );
Expand Down
Loading
Loading