public function testNonExistingDirectory()
 {
     $expected = array();
     try {
         ezcFile::findRecursive("NotHere", array('@xxx@'));
     } catch (ezcBaseFileNotFoundException $e) {
         self::assertEquals("The directory file 'NotHere' could not be found.", $e->getMessage());
     }
 }
 public function testRelative3()
 {
     $result = ezcFile::calculateRelativePath('/foo/1/2/php.php', '/foo/bar');
     self::assertEquals('..' . DIRECTORY_SEPARATOR . '1' . DIRECTORY_SEPARATOR . '2' . DIRECTORY_SEPARATOR . 'php.php', $result);
     $result = ezcFile::calculateRelativePath('/foo/bar/php.php', '/foo/bar');
     self::assertEquals('php.php', $result);
     $result = ezcFile::calculateRelativePath('/php.php', '/foo/bar/1/2');
     self::assertEquals('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'php.php', $result);
     $result = ezcFile::calculateRelativePath('/bar/php.php', '/foo/bar/1/2');
     self::assertEquals('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR . 'php.php', $result);
 }
 public function setUp()
 {
     static $i = 0;
     $this->tempDir = $this->createTempDir(__CLASS__ . sprintf('_%03d', ++$i)) . '/';
     self::copyRecursive(dirname(__FILE__) . '/data/backend_file', $this->tempDir . 'backend/');
     // Remove SVN directories from temporary backend
     $svnDirs = ezcFile::findRecursive($this->tempDir . 'backend/', array('(/\\.svn/entries$)'));
     foreach ($svnDirs as $dir) {
         ezcFile::removeRecursive(dirname($dir));
     }
     // Explicitely set mtime and ctime
     $this->recursiveTouch($this->tempDir . 'backend/', 2147483647);
     // Store current timezone and switch to UTC for test
     $this->oldTimezone = date_default_timezone_get();
     date_default_timezone_set('UTC');
 }
 public function testRecursive5()
 {
     self::assertEquals(12, count(ezcFile::findRecursive($this->tempDir)));
     try {
         ezcFile::removeRecursive($this->tempDir . '/dir6');
     } catch (ezcBaseFilePermissionException $e) {
         self::assertEquals("The file '{$this->tempDir}/dir6/file1.txt' can not be removed.", $e->getMessage());
     }
     self::assertEquals(12, count(ezcFile::findRecursive($this->tempDir)));
 }
 public function testRecursive5()
 {
     self::assertEquals(12, count(ezcFile::findRecursive($this->tempDir)));
     try {
         ezcFile::removeRecursive($this->tempDir . '/dir6');
     } catch (ezcBaseFilePermissionException $e) {
         // Make no asumption on which file is tried to be removed first
         self::assertEquals(1, preg_match("(The file '{$this->tempDir}/dir6/file[12].txt' can not be removed.)", $e->getMessage()));
     }
     self::assertEquals(12, count(ezcFile::findRecursive($this->tempDir)));
 }