Exemplo n.º 1
0
 /**
  * Test isWriteable() with unwriteable file
  */
 public function testIsNotWriteable()
 {
     // 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", 0444);
     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_writeable($this->templateStorePath . "zhadum.ezt"), 'Template file is still writeable');
     self::assertSame(false, $src->isWriteable(), 'Unwriteable template file is considered writeable');
 }