[wp-trac] [WordPress Trac] #25317: Wrong guess in wp_guess_url() for symlinked install, or unit tests

WordPress Trac noreply at wordpress.org
Tue Sep 17 04:37:45 UTC 2013


#25317: Wrong guess in wp_guess_url() for symlinked install, or unit tests
-----------------------------+--------------------
 Reporter:  bpetty           |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  highest omg bbq  |   Milestone:  3.7
Component:  Upgrade/Install  |     Version:  trunk
 Severity:  blocker          |  Resolution:
 Keywords:  has-patch        |
-----------------------------+--------------------

Comment (by dd32):

 So after thinking about it, the only way we could really unit test this
 would be to change
 `$abspath_fix = str_replace( '\\', '/', ABSPATH ); `
 to something like this:
 `$abspath_fix = str_replace( '\\', '/',  ( isset( $_SERVER['ABSPATH'] ) ?
 $_SERVER['ABSPATH'] : ABSPATH ) ); `
 or to put a filter around ABSPATH.

 It'd be nice to have a consistent way to unit test things that use
 `ABSPATH`, for example, for `WP_Filesystem` I had to override the
 `abspath()` method in the Mock FS handler to accept an optional path for
 `ABSPATH` for use during the tests.
 Passing an parameter in works for Unit-test-only functions, but not for
 core functions, leading me to the `$_SERVER` hack above.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25317#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list