From adcb0b5a4aa831414f245542779a5fe219e091c7 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 8 Mar 2016 07:06:12 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/file.php | 22 ----------------- tests/phpunit/tests/functions.php | 41 +++++++++++++++++-------------- 2 files changed, 23 insertions(+), 40 deletions(-) diff --git a/tests/phpunit/tests/file.php b/tests/phpunit/tests/file.php index 0ac1484c93..8ee3e8de20 100644 --- a/tests/phpunit/tests/file.php +++ b/tests/phpunit/tests/file.php @@ -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' ), - ); - } } diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 8e8189a941..8e327c2ca4 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -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() {