Example #1
0
 public function testSet()
 {
     $file = new File(uniqid('.test_'));
     $this->assertFalse($file->exists());
     $file->createNewFile();
     $this->assertTrue($file->exists());
     $this->assertTrue($file->isReadable());
     $this->assertTrue($file->isWritable());
     $this->assertFalse($file->isExecutable());
     $file->setReadable(true);
     $file->setWritable(true);
     $file->setExecutable(true);
     //    var_dump($file->isReadable());
     //    var_dump($file->isWritable());
     //    var_dump($file->isExecutable());
 }
Example #2
0
 /**
  * Check whether the file or directory denoted by the given abstract
  * pathname may be accessed by this process.  The second argument specifies
  * which access, ACCESS_READ, ACCESS_WRITE or ACCESS_EXECUTE, to check.
  * Return false if access is denied or an I/O error occurs
  * @param File $f
  * @param bool $access
  * @return bool
  */
 public function checkAccess(File $f, $access)
 {
     switch ($access) {
         case self::ACCESS_READ:
             return $f->isReadable();
         case self::ACCESS_WRITE:
             return $f->isWritable();
         case self::ACCESS_EXECUTE:
             return $f->isExecutable();
     }
     return false;
 }