Example #1
0
 /**
  * @covers Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::beforeRenderView
  * @covers Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::afterRenderView
  * @covers Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::getRenderLevel
  * @uses Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::setBenchmark
  * @uses Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::getBenchmark
  * @uses Fabfuel\Prophiler\Plugin\PluginAbstract
  * @uses Fabfuel\Prophiler\Profiler
  */
 public function testRenderView()
 {
     $benchmark = $this->getMock('\\Fabfuel\\Prophiler\\Benchmark\\BenchmarkInterface');
     $view = $this->getMock('Phalcon\\Mvc\\View');
     $event = $this->getMockBuilder('Phalcon\\Events\\Event')->disableOriginalConstructor()->getMock();
     $event->expects($this->exactly(1))->method('getSource')->willReturn($view);
     $view->expects($this->once())->method('getCurrentRenderLevel')->willReturn(1);
     $view->expects($this->exactly(5))->method('getActiveRenderPath')->willReturn('main');
     $metadata = ['view' => 'main', 'level' => 'action'];
     $this->profiler->expects($this->once())->method('start')->with(get_class($view) . '::render: main', $metadata, 'View')->willReturn($benchmark);
     $this->profiler->expects($this->once())->method('stop')->with($benchmark);
     $this->viewPlugin->beforeRenderView($event, $view);
     $this->viewPlugin->afterRenderView($event, $view);
 }