/** * @param string $uuidPrefix * * @return AssetMapping */ private function getMappingByUuidPrefix($uuidPrefix) { $expr = Expr::startsWith($uuidPrefix, AssetMapping::UUID); $mappings = $this->assetManager->findAssetMappings($expr); if (!$mappings) { throw new RuntimeException(sprintf('The mapping with the UUID prefix "%s" does not exist.', $uuidPrefix)); } if (count($mappings) > 1) { throw new RuntimeException(sprintf('More than one mapping matches the UUID prefix "%s".', $uuidPrefix)); } return reset($mappings); }
public function testInstallNothing() { $this->assetManager->expects($this->once())->method('getAssetMappings')->willReturn(array()); $this->installationManager->expects($this->never())->method('prepareInstallation'); $this->installationManager->expects($this->never())->method('installResource'); $args = self::$installCommand->parseArgs(new StringArgs('')); $expected = <<<EOF Nothing to install. EOF; $this->assertSame(0, $this->handler->handleInstall($args, $this->io)); $this->assertSame($expected, $this->io->fetchOutput()); $this->assertEmpty($this->io->fetchErrors()); }