Make WordPress Core


Ignore:
Timestamp:
06/18/2024 08:18:51 AM (10 months ago)
Author:
swissspidy
Message:

Build/Test Tools: add new end-to-end tests for edge cases such as maintenance mode.

Sometimes errors only occur in unusual code paths such as the maintenance mode or installation screens. Due to lack of tests for these scenarios in core, such errors are usually only noticed very late. This change adds new end-to-end (e2e) tests to prevent regressions in the following areas:

  • Maintenance mode (presence of a .maintenance file)
  • Fatal error handler (simulated with an mu-plugin that causes an error)
  • Installation screen (verifying full installation flow & that there are no database errors)

Thanks to these tests, an issue was already found and addressed in the default wp_die handler, as wp_robots_noindex_embeds and wp_robots_noindex_search used to cause PHP warnings due to $wp_query not existing.

In the future, these tests can be extended to also test scenarios like localized error pages via wp_load_translations_early().

Fixes #61240.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r58409 r58430  
    38633863        if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) {
    38643864            add_filter( 'wp_robots', 'wp_robots_no_robots' );
     3865            // Prevent warnings because of $wp_query not existing.
     3866            remove_filter( 'wp_robots', 'wp_robots_noindex_embeds' );
     3867            remove_filter( 'wp_robots', 'wp_robots_noindex_search' );
    38653868            wp_robots();
    38663869        }
Note: See TracChangeset for help on using the changeset viewer.