コード例 #1
0
ファイル: ReportCommand.php プロジェクト: Remo/phpbench
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $files = $input->getOption('file');
     if (!$files) {
         throw new \InvalidArgumentException('You must specify at least one result --file (generated by the run command\'s `--dump-file=` option)');
     }
     if (!$input->getOption('report')) {
         throw new \InvalidArgumentException('You must specify or configure at least one report, e.g.: --report=default');
     }
     $this->timeUnitHandler->timeUnitFromInput($input);
     $aggregateDom = new SuiteDocument();
     $aggregateDom->createRoot('phpbench');
     foreach ($files as $file) {
         if (!file_exists($file)) {
             throw new \InvalidArgumentException(sprintf('Could not find suite result file "%s" (cwd: %s)', $file, getcwd()));
         }
         $suiteResult = new SuiteDocument();
         $suiteResult->loadXml(file_get_contents($file));
         $aggregateDom->appendSuiteDocument($suiteResult, basename($file));
     }
     $this->reportHandler->reportsFromInput($input, $output, $aggregateDom);
 }
コード例 #2
0
ファイル: SuiteDocumentTest.php プロジェクト: Remo/phpbench
 /**
  * It should throw an exception if the append target has no phpbench root element.
  *
  * @expectedException InvalidArgumentException
  */
 public function testAppendSuiteDocumentException()
 {
     $suiteDocument = new SuiteDocument();
     $newSuiteDocument = $this->getSuiteDocument();
     $suiteDocument->appendSuiteDocument($newSuiteDocument, 'foo');
 }