PhpBench\Tests\Util\TestUtil::configureBenchmarkMetadata PHP Method

configureBenchmarkMetadata() public static method

public static configureBenchmarkMetadata ( Prophecy\Prophecy\ObjectProphecy $benchmark, array $options = [] )
$benchmark Prophecy\Prophecy\ObjectProphecy
$options array
    public static function configureBenchmarkMetadata(ObjectProphecy $benchmark, array $options = [])
    {
        $options = array_merge(['class' => 'Benchmark', 'beforeClassMethods' => [], 'afterClassMethods' => [], 'path' => null], $options);
        $benchmark->getClass()->willReturn($options['class']);
        $benchmark->getBeforeClassMethods()->willReturn($options['beforeClassMethods']);
        $benchmark->getAfterClassMethods()->willReturn($options['afterClassMethods']);
        $benchmark->getPath()->willReturn($options['path']);
    }

Usage Example

示例#1
0
 /**
  * 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);
 }
All Usage Examples Of PhpBench\Tests\Util\TestUtil::configureBenchmarkMetadata