/** * {@inheritdoc} */ public function restore(OutputInterface $output) { $driver = $this->storageRegistry->getService(); $iterator = new \DirectoryIterator($this->archivePath); $files = $this->filterFiles($iterator); $totalCount = count($files); $files = $this->filterExisting($driver, $files); $count = count($files); $output->writeln(sprintf('Restoring %s of %s suites.', $count, $totalCount)); foreach ($files as $index => $file) { $this->writeProgress($output, $index, $count, '.'); $document = new Document(); $document->load($file->getPathname()); $collection = $this->xmlDecoder->decode($document); $driver->store($collection); } $output->write(PHP_EOL); }
/** * It should throw an exception if an attribute name has no - prefix. * * @expectedException \RuntimeException * @expectedExceptionMessage Expected attribute name to have a result key prefix, got "foo" */ public function testInvalidAttribute() { $dom = new Document(1.0); $dom->loadXml(<<<EOT <phpbench> <suite> <benchmark class="\\PhpBench\\Micro\\Math\\KdeBench"> <subject name="benchKde"> <variant> <iteration foo="12" /> </variant> </subject> </benchmark> </suite> </phpbench> EOT ); $decoder = new XmlDecoder(); $collection = $decoder->decode($dom); }