summaryrefslogtreecommitdiff
path: root/vendor/symfony/debug/Resources/ext/tests/003.phpt
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2017-12-15 11:24:35 -0800
committerFrédéric Guillot <fred@kanboard.net>2017-12-15 11:55:42 -0800
commita93b8e10f5954be0853eec693c13e84c4bd9e6f2 (patch)
treeeda5de9494b819235616e8623bb3393e9cc373af /vendor/symfony/debug/Resources/ext/tests/003.phpt
parent2c72a283f2d51034f85f4e2ca8b194d304a3c433 (diff)
Kanboard requires at least PHP 5.6 now
Diffstat (limited to 'vendor/symfony/debug/Resources/ext/tests/003.phpt')
-rw-r--r--vendor/symfony/debug/Resources/ext/tests/003.phpt85
1 files changed, 85 insertions, 0 deletions
diff --git a/vendor/symfony/debug/Resources/ext/tests/003.phpt b/vendor/symfony/debug/Resources/ext/tests/003.phpt
new file mode 100644
index 00000000..2a494e27
--- /dev/null
+++ b/vendor/symfony/debug/Resources/ext/tests/003.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test ErrorHandler in case of fatal error
+--SKIPIF--
+<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
+--FILE--
+<?php
+
+namespace Psr\Log;
+
+class LogLevel
+{
+ const EMERGENCY = 'emergency';
+ const ALERT = 'alert';
+ const CRITICAL = 'critical';
+ const ERROR = 'error';
+ const WARNING = 'warning';
+ const NOTICE = 'notice';
+ const INFO = 'info';
+ const DEBUG = 'debug';
+}
+
+namespace Symfony\Component\Debug;
+
+$dir = __DIR__.'/../../../';
+require $dir.'ErrorHandler.php';
+require $dir.'Exception/FatalErrorException.php';
+require $dir.'Exception/UndefinedFunctionException.php';
+require $dir.'FatalErrorHandler/FatalErrorHandlerInterface.php';
+require $dir.'FatalErrorHandler/ClassNotFoundFatalErrorHandler.php';
+require $dir.'FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php';
+require $dir.'FatalErrorHandler/UndefinedMethodFatalErrorHandler.php';
+
+function bar()
+{
+ foo();
+}
+
+function foo()
+{
+ notexist();
+}
+
+$handler = ErrorHandler::register();
+$handler->setExceptionHandler('print_r');
+
+if (function_exists('xdebug_disable')) {
+ xdebug_disable();
+}
+
+bar();
+?>
+--EXPECTF--
+Fatal error: Call to undefined function Symfony\Component\Debug\notexist() in %s on line %d
+Symfony\Component\Debug\Exception\UndefinedFunctionException Object
+(
+ [message:protected] => Attempted to call function "notexist" from namespace "Symfony\Component\Debug".
+ [string:Exception:private] =>
+ [code:protected] => 0
+ [file:protected] => %s
+ [line:protected] => %d
+ [trace:Exception:private] => Array
+ (
+ [0] => Array
+ (
+%A [function] => Symfony\Component\Debug\foo
+%A [args] => Array
+ (
+ )
+
+ )
+
+ [1] => Array
+ (
+%A [function] => Symfony\Component\Debug\bar
+%A [args] => Array
+ (
+ )
+
+ )
+%A
+ )
+
+ [previous:Exception:private] =>
+ [severity:protected] => 1
+)