Ejemplo n.º 1
0
 /**
  * @param	FileFinderInterface $finder
  * @return	ResourceTreeBuilder
  */
 public function createVendorList(FileFinderInterface $finder)
 {
     if (!$finder->fileExists()) {
         $err = "failed to create vendor list: file not found at ";
         $err .= "-({$finder->getPath()})";
         throw new DomainException($err);
     }
     $reader = new FileReader($finder);
     $vendors = $reader->decodeJsonAt();
     if (null === $vendors) {
         $err = "error processing json: -({$reader->getLastJsonError()} at ";
         $err .= "{$finder->getPath()})";
         throw new RunTimeException($err);
     }
     return $vendors;
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @depends	noRootPathNoBasePath
  * @return	null
  */
 public function getPathNotUsingBasePath(FileFinderInterface $finder)
 {
     $path = '/user/local/share/pear';
     $this->assertSame($path, $finder->getPath($path));
     $this->assertSame($path, $finder->getPath($path, false));
     $file = new SplFileInfo($path);
     $this->assertSame($path, $finder->getPath($file));
     $this->assertSame($path, $finder->getPath($path, false));
     $path = '/';
     $this->assertSame($path, $finder->getPath($path));
     $this->assertSame($path, $finder->getPath($path, false));
     $this->assertEquals('', $finder->getPath(''));
 }