本文整理匯總了PHP中DebugKitDebugger類的典型用法代碼示例。如果您正苦於以下問題:PHP DebugKitDebugger類的具體用法?PHP DebugKitDebugger怎麽用?PHP DebugKitDebugger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DebugKitDebugger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Configure::write('log', true);
DebugKitDebugger::clearTimers();
TestFireCake::reset();
}
示例2: testSaveTimers
/**
* Test save timers
*
* @return void
*/
public function testSaveTimers()
{
$timers = DebugKitDebugger::getTimers(false);
$this->assertEquals(count($timers), 1);
$this->Article->save(array('user_id' => 1, 'title' => 'test', 'body' => 'test'));
$result = DebugKitDebugger::getTimers(false);
$this->assertEquals(count($result), 2);
}
示例3: render
/**
* Renders view for given action and layout. If $file is given, that is used
* for a view filename (e.g. customFunkyView.ctp).
* Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
*
* @param string $action Name of action to render for
* @param string $layout Layout to use
* @param string $file Custom filename for view
* @return string Rendered Element
*/
function render($action = null, $layout = null, $file = null)
{
DebugKitDebugger::startTimer('viewRender', __('Rendering View', true));
$out = parent::render($action, $layout, $file);
DebugKitDebugger::stopTimer('viewRender');
DebugKitDebugger::stopTimer('controllerRender');
if (isset($this->loaded['toolbar'])) {
$this->loaded['toolbar']->postRender();
}
//Temporary work around to hide the SQL dump at page bottom
Configure::write('debug', 0);
return $this->output;
}
示例4: render
/**
* Renders view for given action and layout. If $file is given, that is used
* for a view filename (e.g. customFunkyView.ctp).
* Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
*
* @param string $action Name of action to render for
* @param string $layout Layout to use
* @param string $file Custom filename for view
* @return string Rendered Element
*/
function render($action = null, $layout = null, $file = null)
{
DebugKitDebugger::startTimer('viewRender', __d('debug_kit', 'Rendering View', true));
$out = parent::render($action, $layout, $file);
DebugKitDebugger::stopTimer('viewRender');
DebugKitDebugger::stopTimer('controllerRender');
DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'View render complete', true));
if (empty($this->params['requested']) && isset($this->loaded['toolbar'])) {
$backend = $this->loaded['toolbar']->getName();
$this->loaded['toolbar']->{$backend}->send();
}
if (empty($this->output)) {
return $out;
}
return $this->output;
}
示例5: render
/**
* Renders view for given action and layout. If $file is given, that is used
* for a view filename (e.g. customFunkyView.ctp).
* Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
*
* @param string $action Name of action to render for
* @param string $layout Layout to use
* @param string $file Custom filename for view
* @return string Rendered Element
*/
function render($action = null, $layout = null, $file = null)
{
DebugKitDebugger::startTimer('viewRender', __d('debug_kit', 'Rendering View', true));
$out = parent::render($action, $layout, $file);
DebugKitDebugger::stopTimer('viewRender');
DebugKitDebugger::stopTimer('controllerRender');
DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'View render complete', true));
if (isset($this->loaded['toolbar'])) {
$backend = $this->loaded['toolbar']->getName();
$this->loaded['toolbar']->{$backend}->send();
}
if (empty($this->output)) {
return $out;
}
//Temporary work around to hide the SQL dump at page bottom
Configure::write('debug', 0);
return $this->output;
}
示例6: testMemorySettingAndGetting
/**
* test making memory use markers.
*
* @return void
**/
function testMemorySettingAndGetting()
{
$result = DebugKitDebugger::setMemoryPoint('test marker');
$this->assertTrue($result);
$result = DebugKitDebugger::getMemoryPoints(true);
$this->assertEqual(count($result), 1);
$this->assertTrue(isset($result['test marker']));
$this->assertTrue(is_numeric($result['test marker']));
$result = DebugKitDebugger::getMemoryPoints();
$this->assertTrue(empty($result));
DebugKitDebugger::setMemoryPoint('test marker');
DebugKitDebugger::setMemoryPoint('test marker');
$result = DebugKitDebugger::getMemoryPoints();
$this->assertEqual(count($result), 2);
$this->assertTrue(isset($result['test marker']));
$this->assertTrue(isset($result['test marker #2']));
}
示例7: clearMemoryPoints
/**
* Clear out any existing memory points
*
* @return void
**/
function clearMemoryPoints()
{
$self =& DebugKitDebugger::getInstance();
$self->__memoryPoints = array();
}
示例8: testBeforeRedirect
/**
* test that vars are gathered and state is saved on beforeRedirect
*
* @return void
**/
public function testBeforeRedirect() {
$this->_loadController(array(
'panels' => array('test', 'session', 'history'),
));
$configName = 'debug_kit';
$this->Controller->Toolbar->cacheKey = 'toolbar_history';
Cache::delete('toolbar_history', $configName);
DebugKitDebugger::startTimer('controllerAction', 'testing beforeRedirect');
$MockPanel = $this->getMock('DebugPanel');
$MockPanel->expects($this->once())->method('beforeRender');
$this->Controller->Toolbar->panels['test'] = $MockPanel;
$this->Controller->Toolbar->beforeRedirect($this->Controller);
$result = Cache::read('toolbar_history', $configName);
$this->assertTrue(isset($result[0]['session']));
$this->assertTrue(isset($result[0]['test']));
$timers = DebugKitDebugger::getTimers();
$this->assertTrue(isset($timers['controllerAction']));
}
示例9: testRenderTimers
/**
* test rendering and ensure that timers are being set.
*
* @access public
* @return void
*/
function testRenderTimers()
{
$this->Controller->viewPath = 'posts';
$this->Controller->action = 'index';
$this->Controller->params = array('action' => 'index', 'controller' => 'posts', 'plugin' => null, 'url' => array('url' => 'posts/index'), 'base' => null, 'here' => '/posts/index');
$this->Controller->layout = 'default';
$View =& new DebugView($this->Controller, false);
$View->render('index');
$result = DebugKitDebugger::getTimers();
$this->assertEqual(count($result), 4);
$this->assertTrue(isset($result['viewRender']));
$this->assertTrue(isset($result['render_default.ctp']));
$this->assertTrue(isset($result['render_index.ctp']));
$result = DebugKitDebugger::getMemoryPoints();
$this->assertTrue(isset($result['View render complete']));
}
示例10: testBeforeRedirect
/**
* test that vars are gathered and state is saved on beforeRedirect
*
* @return void
**/
function testBeforeRedirect()
{
$this->Controller->components = array('DebugKit.Toolbar' => array('panels' => array('MockDebug', 'session', 'history')));
$this->Controller->Component->init($this->Controller);
$this->Controller->Component->initialize($this->Controller);
$configName = 'debug_kit';
$this->Controller->Toolbar->cacheKey = 'toolbar_history';
Cache::delete('toolbar_history', $configName);
DebugKitDebugger::startTimer('controllerAction', 'testing beforeRedirect');
$this->Controller->Toolbar->panels['MockDebug']->expectOnce('beforeRender');
$this->Controller->Toolbar->beforeRedirect($this->Controller);
$result = Cache::read('toolbar_history', $configName);
$this->assertTrue(isset($result[0]['session']));
$this->assertTrue(isset($result[0]['mock_debug']));
$timers = DebugKitDebugger::getTimers();
$this->assertTrue(isset($timers['controllerAction']));
}
示例11: find
/**
* Queries the datasource and returns a result set array.
*
* @param string $type Type of find operation (all / first / count / neighbors / list / threaded)
* @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks)
* @return array Array of records
* @link http://book.cakephp.org/2.0/en/models/deleting-data.html#deleteall
*/
public function find($type = 'first', $query = array())
{
DebugKitDebugger::startTimer($this->name . '::find(' . $type . ')');
$results = parent::find($type, $query);
DebugKitDebugger::stopTimer($this->name . '::find(' . $type . ')');
return $results;
}
示例12: testOutput
/**
* test _output switch to firePHP
*
* @return void
*/
function testOutput()
{
$firecake =& FireCake::getInstance('TestFireCake');
Debugger::invoke(DebugKitDebugger::getInstance('DebugKitDebugger'));
Debugger::output('fb');
$foo .= '';
$result = $firecake->sentHeaders;
$this->assertPattern('/GROUP_START/', $result['X-Wf-1-1-1-1']);
$this->assertPattern('/ERROR/', $result['X-Wf-1-1-1-2']);
$this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-5']);
Debugger::invoke(Debugger::getInstance('Debugger'));
Debugger::output();
}
示例13: beforeRender
/**
* beforeRender Callback
*
* @return array
**/
function beforeRender(&$controller)
{
$this->startTime = DebugKitDebugger::requestStartTime();
$this->currentTime = DebugKitDebugger::requestTime();
$out = array();
foreach ($this->logFiles as $log) {
$file = LOGS . $log;
if (!file_exists($file)) {
continue;
}
$out[$log] = $this->_parseFile($file);
}
return $out;
}
示例14: requestTime
/**
* Get the total execution time until this point
*
* @access public
* @return float elapsed time in seconds since script start.
* @static
*/
function requestTime()
{
$start = DebugKitDebugger::requestStartTime();
$now = getMicroTime();
return $now - $start;
}
示例15: tearDown
/**
* tear down function
*
* @return void
**/
function tearDown()
{
unset($this->View, $this->Controller);
DebugKitDebugger::clearTimers();
Configure::write('debug', $this->_debug);
}