/** * @dataProvider getMockDriversWithVersions */ public function testWithFilterTags($type, $url, $class, $verbose) { $validPackageName = substr($type, 0, strpos($type, '-')) . '-asset/registry-foobar'; $validTraces = array(''); if ($verbose) { $validTraces = array(); } $filter = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Repository\VcsPackageFilter') ->disableOriginalConstructor() ->getMock(); $filter->expects($this->any()) ->method('skip') ->will($this->returnValue(true)); /* @var VcsPackageFilter $filter */ $this->init(true, $type, $url, $class, $verbose, null, 'registry-foobar', $filter); /* @var PackageInterface[] $packages */ $packages = $this->repository->getPackages(); $this->assertCount(3, $packages); foreach ($packages as $package) { if ($package instanceof AliasPackage) { $package = $package->getAliasOf(); } $this->assertInstanceOf('Composer\Package\CompletePackage', $package); $this->assertSame($validPackageName, $package->getName()); } $this->assertSame($validTraces, $this->io->getTraces()); }
/** * @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()); }