/** * returns a bundle * * @return Bundle */ public function bundle() { $bundle = new Bundle(); $iterator = Finder::create()->files()->ignoreVCS(true)->filter($this->package->getBlacklistFilter())->exclude($this->package->getPathVendorRelative())->in($this->package->getDirectory()); $this->logger->log(' Adding whole project directory "' . $this->package->getDirectory() . '"'); return $bundle->addDir($iterator); }
/** * @test */ public function addPackageAddsResourcesFromCalculatedBundle() { $bundle = new Bundle(); $bundle->addFile('path/to/package/file.php'); $this->mockPharComposer->expects($this->once())->method('getPathLocalToBase')->with($this->equalTo('path/to/package/file.php'))->will($this->returnValue('file.php')); $this->mockBox->expects($this->once())->method('addFile')->with($this->equalTo('path/to/package/file.php'), $this->equalTo('file.php')); $mockFinder = $this->createMock('Symfony\\Component\\Finder\\Finder'); $bundle->addDir($mockFinder); $this->mockPharComposer->expects($this->once())->method('getBase')->will($this->returnValue('path/to/package')); $this->mockBox->expects($this->once())->method('buildFromIterator')->with($this->equalTo($mockFinder), $this->equalTo('path/to/package')); $this->targetPhar->addBundle($bundle); }
private function addDir(Bundle $bundle, $dir) { $dir = $this->package->getAbsolutePath(rtrim($dir, '/') . '/'); $this->logger->log(' adding "' . $dir . '"'); $bundle->addDir(Finder::create()->files()->ignoreVCS(true)->in($dir)); }