getFilters() публичный Метод

Whitelist of subject method names.
public getFilters ( )
Пример #1
0
 /**
  * Run all benchmarks (or all applicable benchmarks) in the given path.
  *
  * The $name argument will set the "name" attribute on the "suite" element.
  *
  * @param string $contextName
  * @param string $path
  */
 public function run(RunnerContext $context)
 {
     $executorConfig = $this->executorRegistry->getConfig($context->getExecutor());
     $executor = $this->executorRegistry->getService($executorConfig['executor']);
     $dom = new SuiteDocument();
     $rootEl = $dom->createElement('phpbench');
     $rootEl->setAttribute('version', PhpBench::VERSION);
     $dom->appendChild($rootEl);
     $suiteEl = $rootEl->appendElement('suite');
     $suiteEl->setAttribute('context', $context->getContextName());
     $suiteEl->setAttribute('date', date('c'));
     $suiteEl->setAttribute('config-path', $this->configPath);
     $suiteEl->setAttribute('retry-threshold', $context->getRetryThreshold($this->retryThreshold));
     // add environmental information.
     $this->appendEnvironment($suiteEl);
     // build the collection of benchmarks to be executed.
     $collection = $this->collectionBuilder->buildCollection($context->getPath(), $context->getFilters(), $context->getGroups());
     // log the start of the suite run.
     $this->logger->startSuite($dom);
     /* @var BenchmarkMetadata */
     foreach ($collection->getBenchmarks() as $benchmark) {
         $benchmarkEl = $dom->createElement('benchmark');
         $benchmarkEl->setAttribute('class', $benchmark->getClass());
         $this->logger->benchmarkStart($benchmark);
         $this->runBenchmark($executor, $context, $benchmark, $benchmarkEl);
         $this->logger->benchmarkEnd($benchmark);
         $suiteEl->appendChild($benchmarkEl);
     }
     $this->logger->endSuite($dom);
     return $dom;
 }
Пример #2
0
 /**
  * Run all benchmarks (or all applicable benchmarks) in the given path.
  *
  * The $name argument will set the "name" attribute on the "suite" element.
  *
  * @param string $contextName
  * @param string $path
  */
 public function run(RunnerContext $context)
 {
     $dom = new SuiteDocument();
     $rootEl = $dom->createElement('phpbench');
     $rootEl->setAttribute('version', PhpBench::VERSION);
     $dom->appendChild($rootEl);
     $suiteEl = $rootEl->appendElement('suite');
     $suiteEl->setAttribute('context', $context->getContextName());
     $suiteEl->setAttribute('date', date('c'));
     $suiteEl->setAttribute('config-path', $this->configPath);
     $suiteEl->setAttribute('retry-threshold', $context->getRetryThreshold($this->retryThreshold));
     $collection = $this->collectionBuilder->buildCollection($context->getPath(), $context->getFilters(), $context->getGroups());
     $this->logger->startSuite($dom);
     /* @var BenchmarkMetadata */
     foreach ($collection->getBenchmarks() as $benchmark) {
         $benchmarkEl = $dom->createElement('benchmark');
         $benchmarkEl->setAttribute('class', $benchmark->getClass());
         $this->logger->benchmarkStart($benchmark);
         $this->runBenchmark($context, $benchmark, $benchmarkEl);
         $this->logger->benchmarkEnd($benchmark);
         $suiteEl->appendChild($benchmarkEl);
     }
     $this->logger->endSuite($dom);
     return $dom;
 }
Пример #3
0
 /**
  * It should throw an exception if iterations is not numeric.
  */
 public function testGetters()
 {
     $options = array('context_name' => 'my_context', 'filters' => array('filter_one', 'filter_two'), 'iterations' => 5, 'revolutions' => 6, 'parameters' => array('one' => 2), 'sleep' => 100, 'retry_threshold' => 10);
     $context = new RunnerContext('/path/to', $options);
     $this->assertEquals('/path/to', $context->getPath());
     $this->assertEquals($options['context_name'], $context->getContextName());
     $this->assertEquals($options['filters'], $context->getFilters());
     $this->assertEquals($options['iterations'], $context->getIterations());
     $this->assertEquals($options['revolutions'], $context->getRevolutions());
     $this->assertEquals(array(array($options['parameters'])), $context->getParameterSets());
     $this->assertEquals($options['sleep'], $context->getSleep());
     $this->assertEquals(10, $context->getRetryThreshold());
 }
Пример #4
0
 /**
  * Run all benchmarks (or all applicable benchmarks) in the given path.
  *
  * The $name argument will set the "name" attribute on the "suite" element.
  *
  * @param string $contextName
  * @param string $path
  */
 public function run(RunnerContext $context)
 {
     $executorConfig = $this->executorRegistry->getConfig($context->getExecutor());
     $executor = $this->executorRegistry->getService($executorConfig['executor']);
     // build the collection of benchmarks to be executed.
     $benchmarkMetadatas = $this->benchmarkFinder->findBenchmarks($context->getPath(), $context->getFilters(), $context->getGroups());
     $suite = new Suite($context->getContextName(), new \DateTime(), $this->configPath);
     $suite->setEnvInformations((array) $this->envSupplier->getInformations());
     // log the start of the suite run.
     $this->logger->startSuite($suite);
     try {
         /* @var BenchmarkMetadata */
         foreach ($benchmarkMetadatas as $benchmarkMetadata) {
             $benchmark = $suite->createBenchmark($benchmarkMetadata->getClass());
             $this->runBenchmark($executor, $context, $benchmark, $benchmarkMetadata);
         }
     } catch (StopOnErrorException $e) {
     }
     $suite->generateUuid();
     $this->logger->endSuite($suite);
     return $suite;
 }