/** * Test for checking the logic of custom realpath() implementation * * @param string $path Given path * @param string $expected Expected path * * @dataProvider realpathExamples */ public function testRealpathWorkingCorrectly($path, $expected) { // Trick to get scheme name and path in one action. If no scheme, then there will be only one part $components = explode('://', $expected, 2); list($pathScheme, $localPath) = isset($components[1]) ? $components : array(null, $components[0]); // resolve path parts (single dot, double dot and double delimiters) $localPath = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $localPath); if ($pathScheme) { $localPath = "{$pathScheme}://{$localPath}"; } $actual = PathResolver::realpath($path); $this->assertEquals($localPath, $actual); }