[wp-trac] [WordPress Trac] #31130: WP_INSTALLING causes leakage between unit tests
WordPress Trac
noreply at wordpress.org
Wed Sep 30 15:08:18 UTC 2015
#31130: WP_INSTALLING causes leakage between unit tests
------------------------------------+------------------
Reporter: boonebgorges | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+------------------
Changes (by boonebgorges):
* milestone: Future Release => 4.4
Comment:
This is driving me bonkers.
Thinking about jeremyfelt's suggestions: We who are familiar with the
codebase think of the various constants as being related to each other, by
virtue of being constants. But to a newcomer, they have nothing to do with
each other. So wrapping them in a `wp_defined()` function doesn't make a
lot of sense.
For the purposes of this ticket, I'd like to suggest a more focused
`wp_installing()` function. See [attachment:31130.2.diff]. It works just
like `force_ssl_admin()` and its ilk: store the current setting in a
static variable; `wp_installing()` with no args will return the setting;
`wp_installing( $bool )` will set the value to `$bool` and return the
previous value. The one fancy bit is that we must continue to support the
`WP_INSTALLING` constant, since WP defines it in various places before the
bootstrap (and thus before `wp_installing()` is loaded). So,
`wp_installing()` will default to `true` if `defined( 'WP_INSTALLING' ) &&
WP_INSTALLING`.
Then, in `WP_UnitTest_Factory_For_Blog`, call `wp_installing( false )`
just after creating the blog. This solves the problem raised in the
current ticket.
Again, I'm not opposed to a more general approach to the use of constants,
but `WP_INSTALLING` is more of an internal tool which is a constant by
technical necessity, than it is a "config" setting. A standalone solution
seems prudent.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31130#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list