Tests: Merge the two different wp_normalize_path()
tests.
See #35996, [36881]. git-svn-id: https://develop.svn.wordpress.org/trunk@36882 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8d9b0a9d22
commit
adcb0b5a4a
@ -175,26 +175,4 @@ class Tests_File extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_wp_normalize_path
|
||||
*/
|
||||
function test_wp_normalize_path( $path, $expected ) {
|
||||
$this->assertEquals( $expected, wp_normalize_path( $path ) );
|
||||
}
|
||||
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( '\\\\Domain\\DFSRoots\\share\\path\\', '//Domain/DFSRoots/share/path/' ),
|
||||
array( '\\\\Server\\share\\path', '//Server/share/path' ),
|
||||
|
||||
// Linux paths
|
||||
array( '/www/path/', '/www/path/' ),
|
||||
array( '/www/path/////', '/www/path/' ),
|
||||
array( '/www/path', '/www/path' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -124,26 +124,31 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 33265
|
||||
* @ticket 35996
|
||||
* @group dd32
|
||||
*
|
||||
* @dataProvider data_wp_normalize_path
|
||||
*/
|
||||
function test_wp_normalize_path() {
|
||||
$paths = array(
|
||||
'/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',
|
||||
);
|
||||
function test_wp_normalize_path( $path, $expected ) {
|
||||
$this->assertEquals( $expected, wp_normalize_path( $path ) );
|
||||
}
|
||||
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' ),
|
||||
|
||||
foreach ($paths as $original => $expected) {
|
||||
$this->assertEquals( $expected, wp_normalize_path( $original ) );
|
||||
}
|
||||
// Linux paths
|
||||
array( '/www/path/', '/www/path/' ),
|
||||
array( '/www/path/////', '/www/path/' ),
|
||||
array( '/www/path', '/www/path' ),
|
||||
);
|
||||
}
|
||||
|
||||
function test_wp_unique_filename() {
|
||||
|
Loading…
Reference in New Issue
Block a user