Import from SVN (r45945, r596)
[civicrm-core.git] / tests / phpunit / CRM / Utils / FileTest.php
CommitLineData
6a488035
TO
1<?php
2require_once 'CiviTest/CiviUnitTestCase.php';
3class CRM_Utils_FileTest extends CiviUnitTestCase {
4 function testIsChildPath() {
5 $testCases = array();
6 $testCases[] = array('/ab/cd/ef', '/ab/cd', FALSE);
7 $testCases[] = array('/ab/cd', '/ab/cd/ef', TRUE);
8 $testCases[] = array('/ab/cde', '/ab/cd/ef', FALSE);
9 $testCases[] = array('/ab/cde', '/ab/cd', FALSE);
10 $testCases[] = array('/ab/cd', 'ab/cd/ef', FALSE);
11 foreach ($testCases as $testCase) {
12 $actual = CRM_Utils_File::isChildPath($testCase[0], $testCase[1], FALSE);
13 $this->assertEquals($testCase[2], $actual, sprintf("parent=[%s] child=[%s] expected=[%s] actual=[%s]",
14 $testCase[0], $testCase[1], $testCase[2], $actual
15 ));
16 }
17 }
18}