Changeset View
Changeset View
Standalone View
Standalone View
src/filesystem/__tests__/FilesystemTestCase.php
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | foreach ($test_cases as $test_case) { | ||||
Filesystem::isDescendant($path, $root), | Filesystem::isDescendant($path, $root), | ||||
sprintf( | sprintf( | ||||
'Filesystem::isDescendant(%s, %s)', | 'Filesystem::isDescendant(%s, %s)', | ||||
phutil_var_export($path), | phutil_var_export($path), | ||||
phutil_var_export($root))); | phutil_var_export($root))); | ||||
} | } | ||||
} | } | ||||
public function testRelativePath() { | |||||
$test_cases = array( | |||||
array( | |||||
'/foo/bar/baz', | |||||
'/', | |||||
'foo/bar/baz', | |||||
), | |||||
array( | |||||
'/foo/bar/baz', | |||||
'/foo', | |||||
'bar/baz', | |||||
), | |||||
array( | |||||
'/foo/foobar', | |||||
'/foo/bar/baz', | |||||
'../foobar', | |||||
), | |||||
); | |||||
foreach ($test_cases as $test_case) { | |||||
list($path, $root, $expected) = $test_case; | |||||
$this->assertEqual( | |||||
$expected, | |||||
Filesystem::relativePath($path, $root)); | |||||
} | |||||
} | |||||
} | } |