/**
* {@inheritdoc}
*/
public function archive(OutputInterface $output)
{
$driver = $this->storageRegistry->getService();
if (!$this->filesystem->exists($this->archivePath)) {
$this->filesystem->mkdir($this->archivePath);
}
$runIds = [];
foreach ($driver->history() as $entry) {
$runIds[] = $entry->getRunId();
}
$output->writeln(sprintf('Archiving "%s" suites', count($runIds)));
foreach ($runIds as $index => $runId) {
$filename = $runId . '.xml';
$path = sprintf('%s/%s', $this->archivePath, $filename);
if ($this->filesystem->exists($path)) {
$this->writeProgress($output, $index, count($runIds), 'S');
continue;
}
$this->writeProgress($output, $index, count($runIds), '.');
$collection = $driver->fetch($runId);
$document = $this->xmlEncoder->encode($collection);
$document->save($path);
}
$output->writeln(PHP_EOL);
}