Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | require_once 'CiviTest/CiviUnitTestCase.php'; | |
aba1cd8b EM |
3 | |
4 | /** | |
5 | * Class CRM_Utils_FileTest | |
6 | */ | |
6a488035 | 7 | class CRM_Utils_FileTest extends CiviUnitTestCase { |
00be9182 | 8 | public function testIsChildPath() { |
6a488035 TO |
9 | $testCases = array(); |
10 | $testCases[] = array('/ab/cd/ef', '/ab/cd', FALSE); | |
11 | $testCases[] = array('/ab/cd', '/ab/cd/ef', TRUE); | |
12 | $testCases[] = array('/ab/cde', '/ab/cd/ef', FALSE); | |
13 | $testCases[] = array('/ab/cde', '/ab/cd', FALSE); | |
14 | $testCases[] = array('/ab/cd', 'ab/cd/ef', FALSE); | |
15 | foreach ($testCases as $testCase) { | |
16 | $actual = CRM_Utils_File::isChildPath($testCase[0], $testCase[1], FALSE); | |
17 | $this->assertEquals($testCase[2], $actual, sprintf("parent=[%s] child=[%s] expected=[%s] actual=[%s]", | |
18 | $testCase[0], $testCase[1], $testCase[2], $actual | |
19 | )); | |
20 | } | |
21 | } | |
22 | } |