WordPress.org

Make WordPress Core

Changeset 32139


Ignore:
Timestamp:
04/16/2015 11:59:01 PM (4 years ago)
Author:
boonebgorges
Message:

During PHPUnit tests, don't autodetect permalink structure during WP installation.

The unit tests expect non-pretty permalinks, so there's no benefit to detecting
the ability to have pretty permalinks. Moreover, the wp_remote_get() call can
cause installation to hang when there are DNS issues.

Fixes #31994.

Location:
trunk/tests/phpunit/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/functions.php

    r28797 r32139  
    104104    }
    105105}
     106
     107/**
     108 * Set a permalink structure.
     109 *
     110 * Hooked as a callback to the 'populate_options' action, we use this function to set a permalink structure during
     111 * `wp_install()`, so that WP doesn't attempt to do a time-consuming remote request.
     112 *
     113 * @since 4.2.0
     114 */
     115function _set_default_permalink_structure_for_tests() {
     116    update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
     117}
  • trunk/tests/phpunit/includes/install.php

    r30267 r32139  
    4545}
    4646
     47// Prefill a permalink structure so that WP doesn't try to determine one itself.
     48add_action( 'populate_options', '_set_default_permalink_structure_for_tests' );
     49
    4750wp_install( WP_TESTS_TITLE, 'admin', WP_TESTS_EMAIL, true, null, 'password' );
     51
     52// Delete dummy permalink structure, as prefilled above.
     53if ( ! is_multisite() ) {
     54    delete_option( 'permalink_structure' );
     55}
     56remove_action( 'populate_options', '_set_default_permalink_structure_for_tests' );
    4857
    4958if ( $multisite ) {
Note: See TracChangeset for help on using the changeset viewer.