Ejemplo n.º 1
0
 /** @covers \phpDocumentor\Fileset\Collection::getProjectRoot() */
 public function testGetProjectRootWhenTwoFilesAreVeryFarApart()
 {
     $this->fixture->addFile(__FILE__);
     $this->fixture->addFile($this->getNameOfDataDir() . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'phpDocumentor' . DIRECTORY_SEPARATOR . 'Fileset' . DIRECTORY_SEPARATOR . 'Collection.php');
     // realpath() steals our trailing directory separator
     $expected = realpath($this->getNameOfDataDir() . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     $this->assertEquals($expected, $this->fixture->getProjectRoot());
 }
 /**
  * Constructs a Fileset collection and returns that.
  *
  * @param array $sources    List of source paths.
  * @param array $extensions List of extensions to scan for in directories.
  *
  * @return Collection
  */
 protected function buildCollection(array $sources, array $extensions)
 {
     $collection = new Collection();
     $collection->setAllowedExtensions($extensions);
     foreach ($sources as $path) {
         if (is_dir($path)) {
             $collection->addDirectory($path);
             continue;
         }
         $collection->addFile($path);
     }
     return $collection;
 }