Exemple #1
0
 /**
  * Tests Fs_Node->create(), creating dir
  */
 public function testCreate_Recursive()
 {
     $target = "{$this->file}.y/" . basename($this->file) . ".orig";
     umask(022);
     $new = Fs::symlink($target, "{$this->file}.x", 0, 'dir');
     $this->assertType('Q\\Fs_Symlink_Dir', $new);
     $new->create(0770, Fs::RECURSIVE);
     $this->assertTrue(is_dir("{$this->file}.y/" . basename($this->file) . ".orig"));
     $this->assertEquals('0750', sprintf('%04o', fileperms($target) & 0777));
     $this->assertEquals('0750', sprintf('%04o', fileperms("{$this->file}.y") & 0777));
 }
Exemple #2
0
Fichier : Test.php Projet : jasny/Q
 /**
  * Tests Fs::typeOfNode() with filenames
  */
 public function testTypeOfNode_String_Description_AlwayFollow()
 {
     $this->assertEquals('file', Fs::typeOfNode(__FILE__, Fs::DESCRIPTION | Fs::ALWAYS_FOLLOW));
     $this->assertEquals('directory', Fs::typeOfNode(__DIR__, Fs::DESCRIPTION | Fs::ALWAYS_FOLLOW));
     $this->tmpfiles[] = $link_file = sys_get_temp_dir() . '/q-fs_test.' . md5(uniqid());
     $this->tmpfiles[] = $link_dir = sys_get_temp_dir() . '/q-fs_test.' . md5(uniqid());
     if (symlink(__FILE__, $link_file)) {
         $this->assertEquals('file', Fs::typeOfNode($link_file, Fs::DESCRIPTION | Fs::ALWAYS_FOLLOW));
     }
     if (symlink(__DIR__, $link_dir)) {
         $this->assertEquals('directory', Fs::typeOfNode($link_dir, Fs::DESCRIPTION | Fs::ALWAYS_FOLLOW));
     }
 }
Exemple #3
0
 /**
  * Tests Fs_Node->fifo()
  */
 public function testFifo()
 {
     $this->setExpectedException('Q\\Fs_Exception', "Unable to get '{$this->file}/test': '{$this->file}' is not a directory, but a " . Fs::typeOfNode($this->Fs_Node, Fs::DESCRIPTION));
     $this->Fs_Node->fifo('test');
 }
Exemple #4
0
 /**
  * Tests Fs_Node->__invoke()
  */
 public function test__invoke()
 {
     $this->setExpectedException('Q\\Fs_Exception', "Unable to execute '{$this->file}': This is not a regular file, but a " . Fs::typeOfNode($this->Fs_Node, Fs::DESCRIPTION));
     $file = $this->Fs_Node;
     $file();
 }