public static configureBenchmarkMetadata ( Prophecy\Prophecy\ObjectProphecy $benchmark, array $options = [] ) | ||
$benchmark | Prophecy\Prophecy\ObjectProphecy | |
$options | array |
/** * It should throw an exception if the parameters are not in a valid format. * * @expectedException InvalidArgumentException * @expectedExceptionMessage Each parameter set must be an array, got "string" for TestBench::benchTest */ public function testInvalidParameters() { $this->hierarchy->isEmpty()->willReturn(false); $this->metadata->getSubjects()->willReturn([$this->subjectMetadata->reveal()]); TestUtil::configureBenchmarkMetadata($this->metadata, ['class' => 'TestBench', 'path' => self::PATH]); TestUtil::configureSubjectMetadata($this->subjectMetadata, ['name' => 'benchTest']); $this->reflector->getParameterSets(self::PATH, [])->willReturn(['asd' => 'bar']); $this->factory->getMetadataForFile(self::FNAME); }
/** * It should add environmental information to the DOM. */ public function testEnvironment() { $this->informations['hello'] = new Information('hello', ['say' => 'goodbye']); $subject = new SubjectMetadata($this->benchmark->reveal(), 'name', 0); $this->benchmark->getSubjects()->willReturn([$subject]); TestUtil::configureBenchmarkMetadata($this->benchmark); $this->executor->execute(Argument::type('PhpBench\\Benchmark\\Metadata\\SubjectMetadata'), Argument::type('PhpBench\\Model\\Iteration'), $this->executorConfig)->shouldBeCalledTimes(1)->will($this->loadIterationResultCallback()); $suite = $this->runner->run(new RunnerContext(__DIR__)); $envInformations = $suite->getEnvInformations(); $this->assertSame((array) $this->informations, (array) $envInformations); }