Exemplo n.º 1
0
 public function testEquals()
 {
     $current = new Path(__FILE__);
     $cwd = new Path(getcwd());
     $relative = new Path('.' . $current->makeRelativeTo($cwd));
     $this->assertTrue($current->equals($relative));
     // with virtual path
     $current = new Path('vfs://root/dir/file.ext');
     $relative = new Path('vfs://root/file.ext');
     $this->assertFalse($current->equals($relative));
     $this->assertFalse($current->equals($cwd));
 }
Exemplo n.º 2
0
 public function testLink()
 {
     $origin = new Path(tempnam(sys_get_temp_dir(), 'orig'));
     $target = new File(tempnam(sys_get_temp_dir(), 'target'));
     $target->delete();
     $target = new Path($target->getPathname());
     $file = new File($origin);
     $file->touch();
     $file->linkTo($target);
     $link = $target->toFileDescriptor();
     $this->assertNull($file->getLinkTarget());
     $this->assertTrue($link->exists());
     $this->assertTrue($link->isLink());
     $this->assertTrue($origin->equals($link->getLinkTarget()));
 }