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:
mark_story 2010-09-08 23:38:51 -04:00
parent 5d703c4f50
commit bdb3feb7fd
3 changed files with 7 additions and 7 deletions

View file

@ -257,7 +257,7 @@ class ShellDispatcher {
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . 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'));
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {

View file

@ -105,7 +105,7 @@ class ConsoleErrorHandler extends ErrorHandler {
* @return void
*/
public function _outputMessage($template = null) {
$this->stderr($this->error->getMessage());
$this->stderr($this->error->getMessage() . "\n" . $this->error->getTraceAsString());
}
/**

View file

@ -17,7 +17,7 @@
* @since CakePHP(tm) v 2.0
* @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.
@ -45,7 +45,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
$error = $this->getErrorHandler($exception);
$error->expects($this->once())->method('stderr')
->with('Missing action');
->with($this->stringContains('Missing action'));
$error->render();
}
@ -60,7 +60,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
$error = $this->getErrorHandler($exception);
$error->expects($this->once())->method('stderr')
->with('Too many parameters.');
->with($this->stringContains('Too many parameters.'));
$error->render();
}
@ -75,7 +75,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
$error = $this->getErrorHandler($exception);
$error->expects($this->once())->method('stderr')
->with('dont use me in cli.');
->with($this->stringContains('dont use me in cli.'));
$error->render();
}
@ -90,7 +90,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
$error = $this->getErrorHandler($exception);
$error->expects($this->once())->method('stderr')
->with('dont use me in cli.');
->with($this->stringContains('dont use me in cli.'));
$error->render();
}