Make WordPress Core

Ticket #31994: 31994.diff

File 31994.diff, 1.5 KB (added by boonebgorges, 10 years ago)
  • tests/phpunit/includes/functions.php

    diff --git tests/phpunit/includes/functions.php tests/phpunit/includes/functions.php
    index e8d30cb..c57983b 100644
    function _wp_die_handler_txt( $message, $title, $args ) { 
    102102                        echo "\t $k : $v\n";
    103103                }
    104104        }
    105 }
    106  No newline at end of file
     105}
     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 */
     113function _set_default_permalink_structure_for_tests() {
     114        update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
     115}
  • tests/phpunit/includes/install.php

    diff --git tests/phpunit/includes/install.php tests/phpunit/includes/install.php
    index ff4090e..8a07a72 100644
    foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { 
    4444                $wpdb->$table = $prefixed_table;
    4545}
    4646
     47// Preset 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' );
    4851
     52// Delete dummy permalink structure.
     53if ( ! is_multisite() ) {
     54        delete_option( 'permalink_structure' );
     55}
     56remove_action( 'populate_options', '_set_default_permalink_structure_for_tests' );
     57
    4958if ( $multisite ) {
    5059        echo "Installing network..." . PHP_EOL;
    5160