示例#1
0
 public function testThrowsWhenTryingToSetParent()
 {
     $root = new Root();
     $dir = new Directory('a');
     $this->setExpectedException('\\LogicException');
     $dir->addDirectory($root);
 }
示例#2
0
 public function testURLConstruction()
 {
     $root = new Root();
     $root->setScheme('s://');
     $root->addDirectory($dir = new Directory('dir'));
     $dir->addDirectory($dir = new Directory('dir'));
     $dir->addFile($file = new File('file'));
     $this->assertEquals('s://dir/dir/file', $file->url());
 }
示例#3
0
 public function testPathBuilding()
 {
     $root = new Root();
     $root->addDirectory($d1 = new Directory('dir1'));
     $root->addDirectory($d2 = new Directory('dir2'));
     $d2->addDirectory($d3 = new Directory('dir3'));
     $this->assertEquals('/dir1', $d1->path());
     $this->assertEquals('/dir2', $d2->path());
     $this->assertEquals('/dir2/dir3', $d3->path());
 }
示例#4
0
 public function test_create_should_create_dir_with_nested_structure()
 {
     $directory = new Directory("dir");
     $directory->addDirectory("sub");
     $directory->create();
     $dir = getcwd() . DS . 'dir';
     $sub = $dir . DS . 'sub';
     $this->assertTrue(file_exists($dir));
     $this->assertTrue(file_exists($sub));
     rmdir($sub);
     rmdir($dir);
 }