예제 #1
0
 public static function setUpBeforeClass()
 {
     Magento_Profiler::enable();
     /* Profiler measurements fixture */
     $timersProperty = new ReflectionProperty('Magento_Profiler', '_timers');
     $timersProperty->setAccessible(true);
     $timersProperty->setValue(include __DIR__ . '/_files/timers.php');
     $timersProperty->setAccessible(false);
 }
예제 #2
0
 public function testEnableDisable()
 {
     Magento_Profiler::start('another_root_level_timer');
     Magento_Profiler::stop('another_root_level_timer');
     Magento_Profiler::disable();
     Magento_Profiler::start('this_timer_should_be_ignored');
     Magento_Profiler::stop('this_timer_should_be_ignored');
     Magento_Profiler::enable();
     Magento_Profiler::start('another_root_level_timer');
     Magento_Profiler::start('another_nested_timer');
     Magento_Profiler::stop('another_nested_timer');
     Magento_Profiler::stop('another_root_level_timer');
     $expectedTimers = array('some_root_timer', 'some_root_timer->some_nested_timer', 'some_root_timer->some_nested_timer->some_deeply_nested_timer', 'one_more_root_timer', 'another_root_level_timer', 'another_root_level_timer->another_nested_timer');
     $actualTimers = Magento_Profiler::getTimers();
     $this->assertEquals($expectedTimers, $actualTimers);
 }
예제 #3
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Timer name must not contain a nesting separator.
  */
 public function testClearException()
 {
     Magento_Profiler::enable();
     Magento_Profiler::clear('timer ' . Magento_Profiler::NESTING_SEPARATOR . ' name');
 }
예제 #4
0
 /**
  * Test display method
  */
 public function testDisplayAndRegisterOutput()
 {
     $outputOne = $this->getMock('Magento_Profiler_Driver_Standard_OutputInterface');
     $outputOne->expects($this->once())->method('display')->with($this->_stat);
     $outputTwo = $this->getMock('Magento_Profiler_Driver_Standard_OutputInterface');
     $outputTwo->expects($this->once())->method('display')->with($this->_stat);
     $this->_driver->registerOutput($outputOne);
     $this->_driver->registerOutput($outputTwo);
     Magento_Profiler::enable();
     $this->_driver->display();
     Magento_Profiler::disable();
     $this->_driver->display();
 }
예제 #5
0
 public static function setUpBeforeClass()
 {
     self::$_testResourceName = 'testtest_' . mt_rand(1000, 9999) . '_setup';
     Magento_Profiler::enable();
 }