mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding stack trace to the console error handler. Updating tests.
Changing require to require_once so the test case for ConsoleErrorHandler doesn't blow up in cli.
This commit is contained in:
parent
5d703c4f50
commit
bdb3feb7fd
3 changed files with 7 additions and 7 deletions
|
@ -257,7 +257,7 @@ class ShellDispatcher {
|
||||||
|
|
||||||
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php');
|
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php');
|
||||||
require CORE_PATH . 'cake' . DS . 'bootstrap.php';
|
require CORE_PATH . 'cake' . DS . 'bootstrap.php';
|
||||||
require CORE_PATH . 'cake' . DS . 'console' . DS . 'console_error_handler.php';
|
require_once CORE_PATH . 'cake' . DS . 'console' . DS . 'console_error_handler.php';
|
||||||
set_exception_handler(array('ConsoleErrorHandler', 'handleException'));
|
set_exception_handler(array('ConsoleErrorHandler', 'handleException'));
|
||||||
|
|
||||||
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
|
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ class ConsoleErrorHandler extends ErrorHandler {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function _outputMessage($template = null) {
|
public function _outputMessage($template = null) {
|
||||||
$this->stderr($this->error->getMessage());
|
$this->stderr($this->error->getMessage() . "\n" . $this->error->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* @since CakePHP(tm) v 2.0
|
* @since CakePHP(tm) v 2.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
require CAKE . 'console' . DS . 'console_error_handler.php';
|
require_once CAKE . 'console' . DS . 'console_error_handler.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ConsoleErrorHandler Test case.
|
* ConsoleErrorHandler Test case.
|
||||||
|
@ -45,7 +45,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
|
||||||
$error = $this->getErrorHandler($exception);
|
$error = $this->getErrorHandler($exception);
|
||||||
|
|
||||||
$error->expects($this->once())->method('stderr')
|
$error->expects($this->once())->method('stderr')
|
||||||
->with('Missing action');
|
->with($this->stringContains('Missing action'));
|
||||||
|
|
||||||
$error->render();
|
$error->render();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
|
||||||
$error = $this->getErrorHandler($exception);
|
$error = $this->getErrorHandler($exception);
|
||||||
|
|
||||||
$error->expects($this->once())->method('stderr')
|
$error->expects($this->once())->method('stderr')
|
||||||
->with('Too many parameters.');
|
->with($this->stringContains('Too many parameters.'));
|
||||||
|
|
||||||
$error->render();
|
$error->render();
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
|
||||||
$error = $this->getErrorHandler($exception);
|
$error = $this->getErrorHandler($exception);
|
||||||
|
|
||||||
$error->expects($this->once())->method('stderr')
|
$error->expects($this->once())->method('stderr')
|
||||||
->with('dont use me in cli.');
|
->with($this->stringContains('dont use me in cli.'));
|
||||||
|
|
||||||
$error->render();
|
$error->render();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
|
||||||
$error = $this->getErrorHandler($exception);
|
$error = $this->getErrorHandler($exception);
|
||||||
|
|
||||||
$error->expects($this->once())->method('stderr')
|
$error->expects($this->once())->method('stderr')
|
||||||
->with('dont use me in cli.');
|
->with($this->stringContains('dont use me in cli.'));
|
||||||
|
|
||||||
$error->render();
|
$error->render();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue