Beispiel #1
0
 /**
  * Fetch the source files from the task and return and array of SplInfo.
  *
  * @param Task $task
  * @return array
  */
 protected function fetchSources(Task $task)
 {
     $sources = [];
     foreach ($task->getSources() as $source) {
         // locate new resource and merge them to the existing sources
         $sources = array_merge($sources, $this->locator->locate($source));
     }
     return $sources;
 }
Beispiel #2
0
 public function testFinderPatternWithEndingWildCard()
 {
     $normalizer = new Normalizer($this->getCacheDir());
     $locator = new Locator($normalizer);
     // finder pattern MUST return sources
     mkdir($this->getCacheDir() . '/finder');
     touch($this->getCacheDir() . '/finder/first.css');
     touch($this->getCacheDir() . '/finder/second.css');
     touch($this->getCacheDir() . '/finder/third.js');
     $sources = $locator->locate($this->getCacheDir() . '/finder/*');
     $this->assertCount(3, $sources);
     $allowed = [$this->getCacheDir() . '/finder/first.css', $this->getCacheDir() . '/finder/second.css', $this->getCacheDir() . '/finder/third.js'];
     $this->assertContains($sources[0]->getRealPath(), $allowed);
     $this->assertContains($sources[1]->getRealPath(), $allowed);
     $this->assertContains($sources[2]->getRealPath(), $allowed);
 }