[wp-trac] [WordPress Trac] #43663: Unit Test test_theme_file_uri_returns_valid_uri fails on directories with spaces
WordPress Trac
noreply at wordpress.org
Thu Mar 29 22:15:49 UTC 2018
#43663: Unit Test test_theme_file_uri_returns_valid_uri fails on directories with
spaces
------------------------------+-----------------------------
Reporter: mattkeys | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version: 4.9.5
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
Setting up PHPUnit and running the unit tests for the first time produced
some failures because I was running from a directory with spaces in the
name (WordPress Unit Tests).
4 assertions in total failed, but all 4 of them reference the same
function, here is one of the examples:
{{{
1) Test_Theme_File::test_theme_file_uri_returns_valid_uri with data set #0
('parent-only.php', 'theme-file-parent', array('theme-file-parent'))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'/Users/mattkeys/Desktop/W/WordPress%20Unit%20Tests/tests/phpunit/includes/../data/themedir1/default
/parent-only.php'
+'/Users/mattkeys/Desktop/W/WordPress Unit
Tests/tests/phpunit/includes/../data/themedir1/default/parent-only.php'
}}}
Looking at this test, it makes use of esc_url_raw() which encodes the
spaces as %20, then compares them against the original URI which has does
not have the spaces encoded, so they are not the same.
If this is something that we want to fix, an easy way would be to
str_replace spaces > %20 before running the assertion. Patch attached.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43663>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list