setRevs() public method

public setRevs ( $revs )
コード例 #1
0
ファイル: RunnerTest.php プロジェクト: dantleech/phpbench
 /**
  * It should run the tests.
  *
  * - With 1 iteration, 1 revolution
  * - With 1 iteration, 4 revolutions
  *
  * @dataProvider provideRunner
  */
 public function testRunner($iterations, $revs, array $parameters, $assertionCallbacks)
 {
     $subject = new SubjectMetadata($this->benchmark->reveal(), 'name', 0);
     $subject->setIterations($iterations);
     $subject->setBeforeMethods(['beforeFoo']);
     $subject->setParameterSets([[$parameters]]);
     $subject->setRevs($revs);
     TestUtil::configureBenchmarkMetadata($this->benchmark);
     $this->benchmark->getSubjects()->willReturn([$subject]);
     $this->executor->execute(Argument::type('PhpBench\\Benchmark\\Metadata\\SubjectMetadata'), Argument::type('PhpBench\\Model\\Iteration'), new Config('test', ['executor' => 'microtime']))->shouldBeCalledTimes(count($revs) * array_sum($iterations))->will($this->loadIterationResultCallback());
     $suite = $this->runner->run(new RunnerContext(__DIR__, ['context_name' => 'context']));
     $this->assertInstanceOf('PhpBench\\Model\\Suite', $suite);
     $this->assertNoErrors($suite);
     foreach ($assertionCallbacks as $callback) {
         $callback($this, $suite);
     }
 }
コード例 #2
0
 private function processSubject(SubjectMetadata $subject, $annotation)
 {
     if ($annotation instanceof Annotations\BeforeMethods) {
         $subject->setBeforeMethods($this->resolveValue($annotation, $subject->getBeforeMethods(), $annotation->getMethods()));
     }
     if ($annotation instanceof Annotations\AfterMethods) {
         $subject->setAfterMethods($this->resolveValue($annotation, $subject->getAfterMethods(), $annotation->getMethods()));
     }
     if ($annotation instanceof Annotations\ParamProviders) {
         $subject->setParamProviders($this->resolveValue($annotation, $subject->getParamProviders(), $annotation->getProviders()));
     }
     if ($annotation instanceof Annotations\Iterations) {
         $subject->setIterations($annotation->getIterations());
     }
     if ($annotation instanceof Annotations\Sleep) {
         $subject->setSleep($annotation->getSleep());
     }
     if ($annotation instanceof Annotations\Groups) {
         $subject->setGroups($this->resolveValue($annotation, $subject->getGroups(), $annotation->getGroups()));
     }
     if ($annotation instanceof Annotations\Revs) {
         $subject->setRevs($annotation->getRevs());
     }
     if ($annotation instanceof Annotations\Warmup) {
         $subject->setWarmup($annotation->getRevs());
     }
     if ($annotation instanceof Annotations\Skip) {
         $subject->setSkip(true);
     }
     if ($annotation instanceof Annotations\OutputTimeUnit) {
         $subject->setOutputTimeUnit($annotation->getTimeUnit());
         $subject->setOutputTimePrecision($annotation->getPrecision());
     }
     if ($annotation instanceof Annotations\OutputMode) {
         $subject->setOutputMode($annotation->getMode());
     }
 }