Make WordPress Core


Ignore:
Timestamp:
09/14/2015 01:58:03 AM (9 years ago)
Author:
dd32
Message:

When running on windows systems, normalise the capitalisation of the drive letter for more reliable string comparisons.

Props tyxla
Fixes #33265

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r32631 r34104  
    112112        foreach ($relative_paths as $path)
    113113            $this->assertFalse( path_is_absolute($path), "path_is_absolute('$path') should return false" );
     114    }
     115
     116    /**
     117     * @ticket 33265
     118     */
     119    function test_wp_normalize_path() {
     120        $paths = array(
     121            '/WINDOWS' => '/WINDOWS',
     122            'C:/' => 'C:/',
     123            'C:/WINDOWS' => 'C:/WINDOWS',
     124            'C:/WINDOWS/system32' => 'C:/WINDOWS/system32',
     125            '\\WINDOWS' => '/WINDOWS',
     126            'C:\\' => 'C:/',
     127            'C:\\WINDOWS' => 'C:/WINDOWS',
     128            'C:\\\\WINDOWS' => 'C:/WINDOWS',
     129            'C:\\WINDOWS\\system32' => 'C:/WINDOWS/system32',
     130            '\\\\sambashare\\foo' => '/sambashare/foo',
     131            'c:/windows' => 'C:/windows',
     132            'c:\\windows' => 'C:/windows',
     133        );
     134
     135        foreach ($paths as $original => $expected) {
     136            $this->assertEquals( $expected, wp_normalize_path( $original ) );
     137        }
    114138    }
    115139
Note: See TracChangeset for help on using the changeset viewer.