Exemplo n.º 1
0
 /**
  * Test isReadable() with unreadable file
  */
 public function testIsNotReadable()
 {
     // If running as root you can always write, so this test should be
     // skipped when running as root.
     if (!ezcBaseFeatures::hasFunction("posix_getuid") || posix_getuid() == 0) {
         return;
     }
     copy($this->templatePath . "zhadum.ezt", $this->templateStorePath . "zhadum.ezt");
     // This only works on Linux/Unix, what to do here on other platforms?
     $old = umask(0);
     chmod($this->templateStorePath . "zhadum.ezt", 0222);
     umask($old);
     $src = new ezcTemplateSourceCode($this->templateStorePath . "zhadum.ezt", "planet:zhadum.ezt", false);
     self::assertTrue(file_exists($this->templateStorePath . "zhadum.ezt"), 'Template file does not exist on filesystem');
     self::assertTrue(!is_readable($this->templateStorePath . "zhadum.ezt"), 'Template file is still readable');
     self::assertSame(false, $src->isReadable(), 'Unreadable template file is considered readable');
 }