assertEquals($expected, $file->getAbsolutePath($basePath, $path)); } /** * @return array */ public function dataProviderForTestGetAbsolutePath() { return [ ['/root/path/', 'sub', '/root/path/sub'], ['/root/path/', '/sub', '/root/path/sub'], ['/root/path/', '../sub', '/root/path/../sub'], ['/root/path/', '/root/path/sub', '/root/path/sub'], ]; } /** * @dataProvider dataProviderForTestGetRelativePath */ public function testGetRelativePath($basePath, $path, $expected) { $file = new File(); $this->assertEquals($expected, $file->getRelativePath($basePath, $path)); } /** * @return array */ public function dataProviderForTestGetRelativePath() { return [ ['/root/path/', 'sub', 'sub'], ['/root/path/', '/sub', '/sub'], ['/root/path/', '/root/path/sub', 'sub'], ['/root/path/sub', '/root/path/other', '/root/path/other'], ]; } }