コード例 #1
0
ファイル: XmlArchiver.php プロジェクト: dantleech/phpbench
 /**
  * {@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);
 }
コード例 #2
0
ファイル: XmlEncoderTest.php プロジェクト: dantleech/phpbench
 /**
  * It should encode the suite to an XML document.
  *
  * @dataProvider provideEncode
  */
 public function testEncode(array $params, $expected)
 {
     $expected = str_replace('PHPBENCH_VERSION', PhpBench::VERSION, $expected);
     $collection = $this->getSuiteCollection($params);
     $xmlEncoder = new XmlEncoder();
     $dom = $xmlEncoder->encode($collection);
     $this->assertInstanceOf('PhpBench\\Dom\\Document', $dom);
     $this->assertEquals($expected, $dom->dump());
 }
コード例 #3
0
ファイル: XmlDecoderTest.php プロジェクト: dantleech/phpbench
 private function encode(SuiteCollection $collection)
 {
     $xmlEncoder = new XmlEncoder();
     $dom = $xmlEncoder->encode($collection);
     return $dom;
 }