Exemplo n.º 1
0
 /** @covers \phpDocumentor\Fileset\Collection::getFilenames() */
 public function testGetFilenamesWhenIgnorePatternHidesSomething()
 {
     // load the data test folder... must add non-default extensions first
     $this->fixture->setAllowedExtensions(array('phar', 'txt'));
     $this->fixture->getIgnorePatterns()->append('(phar)');
     $this->fixture->addDirectory($this->getNameOfDataDir());
     $files = $this->fixture->getFilenames();
     // this file should have been seen
     $this->assertContains(realpath($this->getNameOfDataDir() . 'fileWithText.txt'), $files);
     // this file should have been ignored
     $this->assertNotContains(realpath($this->getNameOfDataDir() . 'test.phar'), $files);
 }
 /**
  * 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;
 }