Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Simplify test
  • Loading branch information
sirreal committed Aug 19, 2025
commit 38dfe96e0cf1800c295133eee0ee717fe43d7551
8 changes: 3 additions & 5 deletions tests/phpunit/tests/blocks/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,9 @@ public function test_ensure_preload_data_script_tag_closes() {
)
);

// Need set up rest requests with some data like `<!-- <script>`...
wp_scripts()->registered['wp-api-fetch']->extra['after'] = array();
// Prevent a bunch of noisy or unstable data from being included in the test output.
wp_scripts()->registered['wp-api-fetch']->ver = 'test';
$src = includes_url( '/test-src/api-fetch.js' );
wp_scripts()->registered['wp-api-fetch']->src = $src;
wp_scripts()->registered['wp-api-fetch']->extra['after'] = array();

block_editor_rest_api_preload(
array( '/test/v0/test-62797' ),
Expand All @@ -759,7 +757,7 @@ public function test_ensure_preload_data_script_tag_closes() {
wp_scripts()->do_item( 'wp-api-fetch' );
$output = ob_get_clean();
$expected = <<<HTML
<script src="{$src}?ver=test" id="wp-api-fetch-js"></script>
<script src="http://example.org/wp-includes/js/dist/api-fetch.min.js?ver=test" id="wp-api-fetch-js"></script>
<script id="wp-api-fetch-js-after">
wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( {"/test/v0/test-62797":{"body":["\\u003C!-- unclosed comment and a script tag \\u003Cscript\\u003E\\u003C/script\\u003E"],"headers":{"Allow":"GET"}}} ) );
</script>
Expand Down