Build/Test tools: Backport the fixed tests for wp_normalize_path()
from the 4.5 branch into 4.4.
See #35996 git-svn-id: https://develop.svn.wordpress.org/branches/4.4@45012 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
25f1e5c54f
commit
52eb3fbe3a
@ -115,26 +115,30 @@ class Tests_Functions extends WP_UnitTestCase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ticket 33265
|
* @ticket 33265
|
||||||
|
* @ticket 35996
|
||||||
|
*
|
||||||
|
* @dataProvider data_wp_normalize_path
|
||||||
*/
|
*/
|
||||||
function test_wp_normalize_path() {
|
function test_wp_normalize_path( $path, $expected ) {
|
||||||
$paths = array(
|
$this->assertEquals( $expected, wp_normalize_path( $path ) );
|
||||||
'/WINDOWS' => '/WINDOWS',
|
|
||||||
'C:/' => 'C:/',
|
|
||||||
'C:/WINDOWS' => 'C:/WINDOWS',
|
|
||||||
'C:/WINDOWS/system32' => 'C:/WINDOWS/system32',
|
|
||||||
'\\WINDOWS' => '/WINDOWS',
|
|
||||||
'C:\\' => 'C:/',
|
|
||||||
'C:\\WINDOWS' => 'C:/WINDOWS',
|
|
||||||
'C:\\\\WINDOWS' => 'C:/WINDOWS',
|
|
||||||
'C:\\WINDOWS\\system32' => 'C:/WINDOWS/system32',
|
|
||||||
'\\\\sambashare\\foo' => '/sambashare/foo',
|
|
||||||
'c:/windows' => 'C:/windows',
|
|
||||||
'c:\\windows' => 'C:/windows',
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($paths as $original => $expected) {
|
|
||||||
$this->assertEquals( $expected, wp_normalize_path( $original ) );
|
|
||||||
}
|
}
|
||||||
|
function data_wp_normalize_path() {
|
||||||
|
return array(
|
||||||
|
// Windows paths
|
||||||
|
array( 'C:\\www\\path\\', 'C:/www/path/' ),
|
||||||
|
array( 'C:\\www\\\\path\\', 'C:/www/path/' ),
|
||||||
|
array( 'c:/www/path', 'C:/www/path' ),
|
||||||
|
array( 'c:\\www\\path\\', 'C:/www/path/' ), // uppercase drive letter
|
||||||
|
array( 'c:\\\\www\\path\\', 'C:/www/path/' ),
|
||||||
|
array( '\\\\Domain\\DFSRoots\\share\\path\\', '//Domain/DFSRoots/share/path/' ),
|
||||||
|
array( '\\\\Server\\share\\path', '//Server/share/path' ),
|
||||||
|
array( '\\\\Server\\share', '//Server/share' ),
|
||||||
|
|
||||||
|
// Linux paths
|
||||||
|
array( '/www/path/', '/www/path/' ),
|
||||||
|
array( '/www/path/////', '/www/path/' ),
|
||||||
|
array( '/www/path', '/www/path' ),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_unique_filename() {
|
function test_wp_unique_filename() {
|
||||||
|
Loading…
Reference in New Issue
Block a user