本文整理汇总了PHP中Debugger::invoke方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::invoke方法的具体用法?PHP Debugger::invoke怎么用?PHP Debugger::invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger
的用法示例。
在下文中一共展示了Debugger::invoke方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: _fireError
$this->_fireError($error, $code, $description, $file, $line, $trace, $context);
} else {
echo parent::_output($level, $error, $code, $helpCode, $description, $file, $line, $kontext);
}
}
/**
* Create a FirePHP error message
*
* @param string $error Name of error
* @param string $code Code of error
* @param string $description Description of error
* @param string $file File error occured in
* @param string $line Line error occured on
* @param string $trace Stack trace at time of error
* @param string $context context of error
* @return void
* @access protected
*/
function _fireError($error, $code, $description, $file, $line, $trace, $context)
{
$name = $error . ' - ' . $description;
$message = "{$error} {$code} {$description} on line: {$line} in file: {$file}";
FireCake::group($name);
FireCake::error($message, $name);
FireCake::log($context, 'Context');
FireCake::log($trace, 'Trace');
FireCake::groupEnd();
}
}
Debugger::invoke(DebugKitDebugger::getInstance());
Debugger::getInstance('DebugKitDebugger');
示例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: 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', 'preg:/Undefined variable:\\s+foo/', '/error');
$this->assertTags($result, $data, true);
}
示例5: write
/**
* Used to store a dynamic variable in the Configure instance.
*
* Usage:
* {{{
* Configure::write('One.key1', 'value of the Configure::One[key1]');
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
* Configure::write('One', array(
* 'key1' => 'value of the Configure::One[key1]',
* 'key2' => 'value of the Configure::One[key2]'
* );
*
* Configure::write(array(
* 'One.key1' => 'value of the Configure::One[key1]',
* 'One.key2' => 'value of the Configure::One[key2]'
* ));
* }}}
*
* @link http://book.cakephp.org/view/926/write
* @param array $config Name of var to write
* @param mixed $value Value to set for var
* @return boolean True if write was successful
* @access public
*/
function write($config, $value = null)
{
$_this =& Configure::getInstance();
if (!is_array($config)) {
$config = array($config => $value);
}
foreach ($config as $name => $value) {
if (strpos($name, '.') === false) {
$_this->{$name} = $value;
} else {
$names = explode('.', $name, 4);
switch (count($names)) {
case 2:
$_this->{$names[0]}[$names[1]] = $value;
break;
case 3:
$_this->{$names[0]}[$names[1]][$names[2]] = $value;
break;
case 4:
$names = explode('.', $name, 2);
if (!isset($_this->{$names[0]})) {
$_this->{$names[0]} = array();
}
$_this->{$names[0]} = Set::insert($_this->{$names[0]}, $names[1], $value);
break;
}
}
}
if (isset($config['debug']) || isset($config['log'])) {
$reporting = 0;
if ($_this->debug) {
if (!class_exists('Debugger')) {
require LIBS . 'debugger.php';
}
$reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT;
if (function_exists('ini_set')) {
ini_set('display_errors', 1);
}
$callback = array('Debugger', 'getInstance');
} elseif (function_exists('ini_set')) {
ini_set('display_errors', 0);
}
if (isset($_this->log) && $_this->log) {
if (is_integer($_this->log) && !$_this->debug) {
$reporting = $_this->log;
} else {
$reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT;
}
error_reporting($reporting);
if (!class_exists('CakeLog')) {
require LIBS . 'cake_log.php';
}
if (empty($callback)) {
$callback = array('CakeLog', 'getInstance');
}
}
if (!empty($callback) && !defined('DISABLE_DEFAULT_ERROR_HANDLING') && class_exists('Debugger')) {
Debugger::invoke(call_user_func($callback));
}
error_reporting($reporting);
}
return true;
}
示例6: 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');
}