Beispiel #1
0
 /**
  * @covers Fabfuel\Prophiler\Adapter\Fabfuel\Mongo::__construct
  * @covers Fabfuel\Prophiler\Adapter\Fabfuel\Mongo::start
  * @covers Fabfuel\Prophiler\Adapter\Fabfuel\Mongo::stop
  * @uses Fabfuel\Prophiler\Profiler
  * @uses Fabfuel\Prophiler\Adapter\AdapterAbstract
  */
 public function testConstruct()
 {
     $name = 'foobar';
     $metadata = ['lorem' => 'ipsum'];
     $benchmark = $this->getMock('\\Fabfuel\\Prophiler\\Benchmark\\BenchmarkInterface');
     $identifier = spl_object_hash($benchmark);
     $profiler = $this->getMock('Fabfuel\\Prophiler\\Profiler');
     $profiler->expects($this->once())->method('start')->with($name, $metadata, 'MongoDB')->will($this->returnValue($benchmark));
     $profiler->expects($this->once())->method('stop')->with($benchmark);
     $adapter = new Mongo($profiler);
     $benchmarkIdentifier = $adapter->start($name, $metadata);
     $this->assertSame($benchmarkIdentifier, $identifier);
     $adapter->stop($identifier);
 }