Exemplo n.º 1
0
 public function testAddInput_NonFile()
 {
     $input = new \vc\App\Paths();
     try {
         $input->addInput(\r8\FileSys::create($this->dir . '/NotAFile'));
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\Argument $err) {
     }
 }
Exemplo n.º 2
0
 /**
  * Builds the configuration
  *
  * @return \vc\App\Config
  */
 public function build(\r8\CLI\Result $cli)
 {
     if ($cli->countArgs() < 2) {
         throw new \r8\Exception\Argument(0, 'CLI Args', 'Less than two arguments given');
     }
     $args = $cli->getArgs();
     $output = new \r8\FileSys\Dir(array_shift($args));
     $paths = new \vc\App\Paths();
     foreach ($args as $path) {
         $paths->addInput(\r8\FileSys::create($path));
     }
     return new \vc\App\Config($output, $paths);
 }
Exemplo n.º 3
0
 public function testCreate()
 {
     $dir = \r8\FileSys::create(__DIR__);
     $this->assertThat($dir, $this->isInstanceOf('r8\\FileSys\\Dir'));
     $this->assertEquals(__DIR__ . "/", $dir->getPath());
     $newDir = \r8\FileSys::create($dir);
     $this->assertThat($newDir, $this->isInstanceOf('r8\\FileSys\\Dir'));
     $this->assertNotSame($dir, $newDir);
     $this->assertEquals(__DIR__ . "/", $newDir->getPath());
     $file = \r8\FileSys::create(__FILE__);
     $this->assertThat($file, $this->isInstanceOf('r8\\FileSys\\File'));
     $this->assertEquals(__FILE__, $file->getPath());
     $newFile = \r8\FileSys::create($file);
     $this->assertThat($newFile, $this->isInstanceOf('r8\\FileSys\\File'));
     $this->assertNotSame($file, $newFile);
     $this->assertEquals(__FILE__, $newFile->getPath());
     $file = \r8\FileSys::create("/path/to/the/abyss");
     $this->assertThat($file, $this->isInstanceOf('r8\\FileSys\\File'));
     $this->assertEquals("/path/to/the/abyss", $file->getPath());
 }
Exemplo n.º 4
0
 /**
  * Returns the file represented by this instance
  *
  * @return \r8\FileSys
  */
 public function getFile()
 {
     if (!isset($this->file)) {
         $this->file = \r8\FileSys::create($this->base . "/" . $this->path);
         $this->file->resolve();
     }
     return clone $this->file;
 }