public function testRealPath() { $this->assertTrue(chdir(__DIR__ . '/../')); $this->assertEquals(Path::normalize("/foo/bar/../foo.txt"), "/foo/foo.txt"); $this->assertEquals(Path::normalize("/foo/bar/../../foo.txt"), "/foo.txt"); $this->assertEquals(Path::normalize("/foo/bar/./foo.txt"), "/foo/bar/foo.txt"); $this->assertEquals(Path::normalize("C:\\cesar\\rodas\\..\\foo.txt"), "C:/cesar/foo.txt"); $this->assertEquals(Path::normalize("tests/../tests/PathTest.php"), __DIR__ . "/PathTest.php"); }
public function __construct($filePath, $parser = null) { $this->remember = Remember::ns('notoj'); $files = array(); foreach ((array) $filePath as $file) { if (!is_file($file) || !is_readable($file)) { throw new \RuntimeException("{$filePath} is not a file or cannot be read"); } $files[] = Path::normalize($file); } $this->files = $files; $this->annotations = new Annotations(); foreach ((array) $files as $file) { $this->doParse($file, $parser); } }