public function dump(array $packages)
{
$mappedPackages = $this->getMappedPackageList($packages);
$name = $this->rootPackage->getPrettyName();
if ($name === '__root__') {
$name = 'A';
$this->output->writeln('Define a "name" property in your json config to name the repository');
}
if (!$this->rootPackage->getHomepage()) {
$this->output->writeln('Define a "homepage" property in your json config to configure the repository URL');
}
$this->setDependencies($packages);
$this->output->writeln('<info>Writing web view</info>');
$content = $this->getTwigEnvironment()->render($this->getTwigTemplate(), ['name' => $name, 'url' => $this->rootPackage->getHomepage(), 'description' => $this->rootPackage->getDescription(), 'packages' => $mappedPackages, 'dependencies' => $this->dependencies]);
file_put_contents($this->outputDir . '/index.html', $content);
}
/** * @dataProvider dataAbandoned */ public function testAbandoned($abandoned, $expected) { $webBuilder = new WebBuilder(new NullOutput(), vfsStream::url('build'), array(), false); $webBuilder->setRootPackage($this->rootPackage); $this->package->setAbandoned($abandoned); $webBuilder->dump(array($this->package)); $html = $this->root->getChild('build/index.html')->getContent(); $this->assertRegExp('/Package vendor\\/name is abandoned, you should avoid using it/', $html); $this->assertRegExp($expected, $html); }