/** * @param string $type * @param bool $verbose * @param string $exceptionClass * @param string $validTrace * * @dataProvider getConfigIoForException */ public function testTagWithTransportException($type, $verbose, $exceptionClass, $validTrace) { /* @var \PHPUnit_Framework_MockObject_MockObject $loader */ $loader = $this->loader; $loader ->expects($this->any()) ->method('load') ->will($this->throwException(new $exceptionClass('MESSAGE'))); $this->lazyLoader = $this->createLazyLoaderConfigured($type, $verbose); $package = $this->lazyLoader->load($this->lazyPackage); $this->assertFalse($package); $filename = $this->assetType->getFilename(); $validOutput = array(''); if ($verbose) { $validOutput = array( 'Reading ' . $filename . ' of <info>' . $this->lazyPackage->getName() . '</info> (<comment>' . $this->lazyPackage->getPrettyVersion() . '</comment>)', 'Importing empty ' . $type . ' ' . $this->lazyPackage->getPrettyVersion() . ' (' . $this->lazyPackage->getVersion() . ')', $validTrace, '', ); } $this->assertSame($validOutput, $this->io->getTraces()); $packageCache = $this->lazyLoader->load($this->lazyPackage); $this->assertFalse($packageCache); $this->assertSame($validOutput, $this->io->getTraces()); }
/** * Creates the lazy loader of package. * * @param string $type * @param string $identifier * @param array $packageData * @param VcsDriverInterface $driver * * @return LazyAssetPackageLoader */ protected function createLazyLoader($type, $identifier, array $packageData, VcsDriverInterface $driver) { $lazyLoader = new LazyAssetPackageLoader($type, $identifier, $packageData); $lazyLoader->setAssetType($this->assetType); $lazyLoader->setLoader($this->loader); $lazyLoader->setDriver(clone $driver); $lazyLoader->setIO($this->io); $lazyLoader->setEventDispatcher($this->dispatcher); return $lazyLoader; }