[wp-trac] [WordPress Trac] #36567: Allow overriding constants in testing framework

WordPress Trac noreply at wordpress.org
Wed Apr 20 05:09:51 UTC 2016


#36567: Allow overriding constants in testing framework
------------------------------+------------------------
 Reporter:  rmccue            |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  4.6
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:  multisite
------------------------------+------------------------
Changes (by jeremyfelt):

 * keywords:  has-patch => needs-patch


Comment:

 Yeah.

 If you define `SUBDOMAIN_INSTALL` as `true` in `wp-tests-config.php`:

 * `wp-tests-config.php` is passed to the the test installer, which loads
 `wp-settings.php`.
 * In `wp-settings.php`, `wp_not_installed()` fires, which checks
 `is_multisite()`.
 * `is_multisite()` falls back to `SUBDOMAIN_INSTALL` if `MULTISITE` has
 not been defined, so passes.
 * `is_blog_installed()` is then checked.
 * `$wpdb->options` is `wptests_1_options`, because
 `$wpdb->get_blog_prefix()` checks `MULTISITE`, not `SUBDOMAIN_INSTALL`.
 * `wptests_1_options` doesn't exist, nor do any of the `wptests_1_*`
 tables, and so `dead_db()` is fired.
 * A bunch of HTML outputs to show the error page, which is more annoying
 than anything because the tests work just fine if you've already run
 everything once before setting `SUBDOMAIN_INSTALL`.

 So I guess the first question is: Why do we not use `is_multisite()` in
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-
 db.php#L946 $wpdb->get_blog_prefix], because changing that appears to fix
 this and allow the tests to install fresh if you recreate the DB.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36567#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list