本文整理汇总了PHP中Debugger::output方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::output方法的具体用法?PHP Debugger::output怎么用?PHP Debugger::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger
的用法示例。
在下文中一共展示了Debugger::output方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOutput
/**
* test output switch to firePHP
*
* @return void
*/
public function testOutput()
{
$firecake = FireCake::getInstance('TestFireCake');
Debugger::getInstance('DebugKitDebugger');
Debugger::addFormat('fb', array('callback' => 'DebugKitDebugger::fireError'));
Debugger::output('fb');
set_error_handler('ErrorHandler::handleError');
$foo .= '';
restore_error_handler();
$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-4']);
Debugger::getInstance('Debugger');
Debugger::output();
}
示例2: testChangeOutputFormats
/**
* Tests that changes in output formats using Debugger::output() change the templates used.
*
* @return void
*/
public function testChangeOutputFormats()
{
set_error_handler('Debugger::showError');
$this->_restoreError = true;
Debugger::output('js', array('traceLine' => '{:reference} - <a href="txmt://open?url=file://{:file}' . '&line={:line}">{:path}</a>, line {:line}'));
$result = Debugger::trace();
$this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\\/|[A-Z]:\\\\)' . '/', $result);
Debugger::output('xml', array('error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' . '{:description}</error>', 'context' => "<context>{:context}</context>", 'trace' => "<stack>{:trace}</stack>"));
Debugger::output('xml');
ob_start();
$foo .= '';
$result = ob_get_clean();
$data = array('error' => array(), 'code' => array(), '8', '/code', 'file' => array(), 'preg:/[^<]+/', '/file', 'line' => array(), '' . (intval(__LINE__) - 7), '/line', 'preg:/Undefined variable:\\s+foo/', '/error');
$this->assertTags($result, $data, true);
}
示例3: 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();
}
示例4: define
if (!isset($_SERVER['SERVER_NAME'])) {
$_SERVER['SERVER_NAME'] = '';
}
if (empty($_GET['output'])) {
$_GET['output'] = 'html';
}
/**
*
* Used to determine output to display
*/
define('CAKE_TEST_OUTPUT_HTML', 1);
define('CAKE_TEST_OUTPUT_TEXT', 2);
if (isset($_GET['output']) && $_GET['output'] == 'html') {
define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML);
} else {
Debugger::output('txt');
define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT);
}
if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
CakePHPTestHeader();
include CAKE_TESTS_LIB . 'simpletest.php';
CakePHPTestSuiteFooter();
exit;
}
$analyzeCodeCoverage = false;
if (isset($_GET['code_coverage'])) {
$analyzeCodeCoverage = true;
require_once CAKE_TESTS_LIB . 'code_coverage_manager.php';
if (!extension_loaded('xdebug')) {
CakePHPTestHeader();
include CAKE_TESTS_LIB . 'xdebug.php';
示例5: testOutput
/**
* testOutput method
*
* @access public
* @return void
*/
function testOutput()
{
Debugger::invoke(Debugger::getInstance());
$result = Debugger::output(false);
$this->assertEqual($result, '');
$out .= '';
$result = Debugger::output(true);
$this->assertEqual($result[0]['error'], 'Notice');
$this->assertEqual($result[0]['description'], 'Undefined variable: out');
$this->assertPattern('/DebuggerTest::testOutput/', $result[0]['trace']);
$this->assertPattern('/SimpleInvoker::invoke/', $result[0]['trace']);
ob_start();
Debugger::output('txt');
$other .= '';
$result = ob_get_clean();
$this->assertPattern('/Undefined variable: other/', $result);
$this->assertPattern('/Context:/', $result);
$this->assertPattern('/DebuggerTest::testOutput/', $result);
$this->assertPattern('/SimpleInvoker::invoke/', $result);
ob_start();
Debugger::output('html');
$wrong .= '';
$result = ob_get_clean();
$this->assertPattern('/<pre class="cake-debug">.+<\\/pre>/', $result);
$this->assertPattern('/<b>Notice<\\/b>/', $result);
$this->assertPattern('/variable: wrong/', $result);
ob_start();
Debugger::output('js');
$buzz .= '';
$result = ob_get_clean();
$this->assertPattern("/<a href\\='javascript:void\\(0\\);' onclick\\='/", $result);
$this->assertPattern('/<b>Notice<\\/b>/', $result);
$this->assertPattern('/Undefined variable: buzz/', $result);
$this->assertPattern('/<a[^>]+>Code<\\/a>/', $result);
$this->assertPattern('/<a[^>]+>Context<\\/a>/', $result);
set_error_handler('simpleTestErrorHandler');
}
示例6: testChangeOutputFormats
/**
* Tests that changes in output formats using Debugger::output() change the templates used.
*
* @return void
*/
function testChangeOutputFormats()
{
Debugger::invoke(Debugger::getInstance());
Debugger::output('js', array('traceLine' => '{:reference} - <a href="txmt://open?url=file://{:file}' . '&line={:line}">{:path}</a>, line {:line}'));
$result = Debugger::trace();
$this->assertPattern('/' . preg_quote('txmt://open?url=file:///', '/') . '/', $result);
Debugger::output('xml', array('error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' . '{:description}</error>', 'context' => "<context>{:context}</context>", 'trace' => "<stack>{:trace}</stack>"));
Debugger::output('xml');
ob_start();
$foo .= '';
$result = ob_get_clean();
set_error_handler('simpleTestErrorHandler');
$data = array('error' => array(), 'code' => array(), '8', '/code', 'file' => array(), 'preg:/[^<]+/', '/file', 'line' => array(), '' . (intval(__LINE__) + -8), '/line', 'Undefined variable: foo', '/error');
$this->assertTags($result, $data, true);
}
示例7: beforeRender
public function beforeRender()
{
//Sl::krumo($this->params);
if ($this->RequestHandler->isAjax()) {
if (is_array($this->output)) {
SlConfigure::write('Sl.debug.requestTime', false);
Configure::write('debug', 0);
echo json_encode($this->output);
die;
}
}
if ($this->layout == 'default') {
$this->layout = SlConfigure::read('View.layout');
}
if (empty($this->layout)) {
$this->layout = empty($this->params['prefix']) || $this instanceof CakeErrorController && $this->params['prefix'] != 'admin' ? 'default' : $this->params['prefix'];
}
$this->theme = SlConfigure::read2('View.theme');
if (empty($this->viewVars['title'])) {
$model = $this->_humanizedModelClass();
switch ($this->action) {
case 'index':
case 'admin_index':
$this->set('title', __t(Inflector::pluralize($model)));
break;
case 'admin_add':
$this->set('title', __t($this->id ? 'Clone {$model}' : 'Add {$model}', array('model' => __t($model))));
break;
case 'admin_edit':
$this->set('title', __t('Edit {$model}', array('model' => __t($model))));
break;
default:
$this->set('title', null);
}
} elseif (empty($this->viewVars['title_for_layout'])) {
$this->viewVars['title_for_layout'] = $this->viewVars['title'];
}
// merge 'site title' and 'view title'
if (empty($this->viewVars['title_for_layout'])) {
$this->viewVars['title_for_layout'] = SlConfigure::read2('Site.title');
} else {
$this->viewVars['title_for_layout'] .= SlConfigure::read('View.options.titleSep') . SlConfigure::read2('Site.title');
}
if (Sl::getInstance()->main && ob_get_level()) {
SlConfigure::write('View.bufferedOutput', ob_get_clean());
}
if (class_exists('Debugger')) {
Debugger::output('js');
}
}
示例8: testOutput
function testOutput()
{
if (file_exists(APP . DS . 'vendors' . DS . 'simpletest' . DS . 'reporter.php')) {
define('SIMPLETESTVENDORPATH', 'APP' . DS . 'vendors');
} else {
define('SIMPLETESTVENDORPATH', 'CORE' . DS . 'vendors');
}
Debugger::invoke(Debugger::getInstance());
$result = Debugger::output(false);
$this->assertEqual($result, '');
$out .= '';
$result = Debugger::output(true);
$expected = array(array('error' => 'Notice', 'code' => '8', 'description' => 'Undefined variable: out', 'line' => '48', 'file' => 'CORE/cake/tests/cases/libs/debugger.test.php', 'context' => array("\$result\t=\tnull"), 'trace' => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 48\nSimpleInvoker::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/invoker.php, line 68\nSimpleInvokerDecorator::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/invoker.php, line 126\nSimpleErrorTrappingInvoker::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/errors.php, line 48\nSimpleInvokerDecorator::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/invoker.php, line 126\nSimpleExceptionTrappingInvoker::invoke() - " . SIMPLETESTVENDORPATH . "/simpletest/exceptions.php, line 42\nSimpleTestCase::run() - " . SIMPLETESTVENDORPATH . "/simpletest/test_case.php, line 135\nTestSuite::run() - " . SIMPLETESTVENDORPATH . "/simpletest/test_case.php, line 588\nTestSuite::run() - " . SIMPLETESTVENDORPATH . "/simpletest/test_case.php, line 591\nTestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93\n[main] - APP/webroot/test.php, line 240"));
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
$this->assertEqual($result, $expected);
ob_start();
Debugger::output('txt');
$other .= '';
$result = ob_get_clean();
$expected = "Notice: 8 :: Undefined variable: other on line 71 of CORE/cake/tests/cases/libs/debugger.test.php\n";
$expected .= 'Context:
$result = array(array("error" => "Notice","code" => 8,"description" => "Undefined variable: out","line" => 48,"file" => "CORE/cake/tests/cases/libs/debugger.test.php","context" => array("$result = null"),"trace" => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 48
SimpleInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/exceptions.php, line 42
SimpleTestCase::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 135
TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 588
TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240"))
$out = "[empty string]"
$expected = array(array("error" => "Notice","code" => "8","description" => "Undefined variable: out","line" => "48","file" => "CORE/cake/tests/cases/libs/debugger.test.php","context" => array("$result = null"),"trace" => "DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 48
SimpleInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/exceptions.php, line 42
SimpleTestCase::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 135
TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 588
TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240"))
';
$expected .= 'Trace:
DebuggerTest::testOutput() - CORE/cake/tests/cases/libs/debugger.test.php, line 71
SimpleInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 68
SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleErrorTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/errors.php, line 48
SimpleInvokerDecorator::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/invoker.php, line 126
SimpleExceptionTrappingInvoker::invoke() - ' . SIMPLETESTVENDORPATH . '/simpletest/exceptions.php, line 42
SimpleTestCase::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 135
TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 588
TestSuite::run() - ' . SIMPLETESTVENDORPATH . '/simpletest/test_case.php, line 591
TestManager::runTestCase() - CORE/cake/tests/lib/test_manager.php, line 93
[main] - APP/webroot/test.php, line 240';
$result = str_replace(array("\t", "\r\n", "\n"), "", $result);
$expected = str_replace(array("\t", "\r\n", "\n"), "", $expected);
$this->assertEqual($result, $expected);
set_error_handler('simpleTestErrorHandler');
}
示例9: showAll
/**
* @param array $options
*
* @codeCoverageIgnore
*/
public static function showAll($options = [])
{
// Stop started items
if (count(self::$runningItems)) {
foreach (self::$runningItems as $key => $value) {
self::stop($key);
}
}
// Output items
$output = '';
$itemCount = 1;
foreach (self::$collection as $key => $item) {
$stats = self::getStats($key, $options);
if (php_sapi_name() == 'cli') {
$output .= (!empty($output) ? "\n" : '') . $stats;
} else {
$output .= '<div class="xicrow-php-debug-timer">';
$output .= $stats;
$output .= '</div>';
}
$itemCount++;
unset($stats);
}
unset($itemCount);
if (php_sapi_name() != 'cli') {
$output .= '<style type="text/css">';
$output .= 'pre.xicrow-php-debug-debugger div.xicrow-php-debug-timer{';
$output .= 'cursor: pointer;';
$output .= '}';
$output .= 'pre.xicrow-php-debug-debugger div.xicrow-php-debug-timer:hover{';
$output .= 'font-weight: bold;';
$output .= 'background-color: #EEE;';
$output .= '}';
$output .= '</style>';
}
Debugger::output($output);
}
示例10: outputError
/**
* Handles object conversion to debug string.
*
* @param string $var Object to convert
*/
public function outputError($data = array()) {
extract($data);
if (is_array($level)) {
$error = $level['error'];
$code = $level['code'];
if (isset($level['helpID'])) {
$helpID = $level['helpID'];
} else {
$helpID = '';
}
$description = $level['description'];
$file = $level['file'];
$line = $level['line'];
$context = $level['context'];
$level = $level['level'];
}
$files = $this->trace(array('start' => 2, 'format' => 'points'));
$listing = $this->excerpt($files[0]['file'], $files[0]['line'] - 1, 1);
$trace = $this->trace(array('start' => 2, 'depth' => '20'));
if ($this->_outputFormat == 'fb') {
$kontext = array();
foreach ((array)$context as $var => $value) {
$kontext[] = "\${$var}\t=\t" . $this->exportVar($value, 1);
}
$this->_fireError($error, $code, $description, $file, $line, $trace, $kontext);
} else {
$data = compact(
'level', 'error', 'code', 'helpID', 'description', 'file', 'path', 'line', 'context'
);
echo parent::output($data);
}
}