コード例 #1
0
ファイル: ViewPluginTest.php プロジェクト: dez-php/prophiler
 /**
  * @covers Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::getBenchmark
  * @covers Fabfuel\Prophiler\Plugin\Phalcon\Mvc\ViewPlugin::setBenchmark
  * @covers Fabfuel\Prophiler\Plugin\PluginAbstract
  * @uses Fabfuel\Prophiler\Plugin\PluginAbstract
  * @uses Fabfuel\Prophiler\Profiler
  */
 public function testGetAndSetBenchmark()
 {
     $view = $this->getMockBuilder('Phalcon\\Mvc\\View')->disableOriginalConstructor()->getMock();
     $view->expects($this->any())->method('getActiveRenderPath')->willReturn('test');
     $benchmark1 = $this->getMock('\\Fabfuel\\Prophiler\\Benchmark\\BenchmarkInterface');
     $benchmark2 = $this->getMock('\\Fabfuel\\Prophiler\\Benchmark\\BenchmarkInterface');
     $this->viewPlugin->setBenchmark($view, $benchmark1);
     $this->viewPlugin->setBenchmark($view, $benchmark2);
     $this->assertSame($benchmark1, $this->viewPlugin->getBenchmark($view));
     $this->assertSame($benchmark2, $this->viewPlugin->getBenchmark($view));
     $this->assertNull($this->viewPlugin->getBenchmark($view));
 }
コード例 #2
0
ファイル: Phalcon.php プロジェクト: dez-php/prophiler
 /**
  * Register ViewPlugin in common event manager
  *
  * We can not get the potentially custom events manager from the view, as the view is set up during
  * application and module bootstrapping. It does not exist before $application->handle()
  *
  * @return bool
  */
 public function registerView()
 {
     $this->eventsManager->attach('view', ViewPlugin::getInstance($this->getProfiler()));
     return true;
 }
コード例 #3
0
ファイル: Phalcon.php プロジェクト: tresemece/monte
 public function register()
 {
     $this->eventsManager->attach('dispatch', DispatcherPlugin::getInstance($this->getProfiler()));
     $this->eventsManager->attach('view', ViewPlugin::getInstance($this->getProfiler()));
     $this->eventsManager->attach('db', AdapterPlugin::getInstance($this->getProfiler()));
 }