public function testAbsoluteToRelativePath() { $path = '/foo/bar/file.ext'; $relativeTo = '/foo/foo/'; $this->assertSame('../bar/file.ext', FileInfo::absoluteToRelativePath($path, $relativeTo)); $path = '/foo/bar/file.ext'; $relativeTo = '/bar/foo/'; $this->assertSame('../../foo/bar/file.ext', FileInfo::absoluteToRelativePath($path, $relativeTo)); $path = '/foo/bar/file.ext'; $relativeTo = 'bar/foo/'; $this->expectException('SR\\Exception\\InvalidArgumentException'); $this->assertSame('../../foo/bar/file.ext', FileInfo::absoluteToRelativePath($path, $relativeTo)); $this->assertSame('../../foo/bar/file.ext', FileInfo::absoluteToRelativePath($path)); }