Skip to content

Commit

Permalink
Fix incorrect error handler being active in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 21, 2013
1 parent 660e0fc commit ecb9c71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions lib/Cake/Test/TestCase/Console/ConsoleErrorHandlerTest.php
@@ -1,7 +1,5 @@
<?php
/**
* ConsoleErrorHandler Test case
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
Expand All @@ -24,8 +22,6 @@

/**
* ConsoleErrorHandler Test case.
*
* @package Cake.Test.Case.Console
*/
class ConsoleErrorHandlerTest extends TestCase {

Expand Down
9 changes: 4 additions & 5 deletions lib/Cake/Test/TestCase/Error/ErrorHandlerTest.php
Expand Up @@ -43,6 +43,7 @@ class ErrorHandlerTest extends TestCase {
*/
public function setUp() {
parent::setUp();

App::build(array(
'View' => array(
CAKE . 'Test/TestApp/View/'
Expand Down Expand Up @@ -154,7 +155,7 @@ public function testHandleErrorDebugOff() {

$this->_logger->expects($this->once())
->method('write')
->with('notice', 'Notice (8): Undefined variable: out in [' . __FILE__ . ', line 159]');
->with('notice', 'Notice (8): Undefined variable: out in [' . __FILE__ . ', line ' . (__LINE__ + 2) . ']');

$out .= '';
}
Expand All @@ -168,6 +169,7 @@ public function testHandleErrorLoggingTrace() {
Configure::write('debug', 0);
$errorHandler = new ErrorHandler(['trace' => true]);
$errorHandler->register();
$this->_restoreError = true;

$this->_logger->expects($this->once())
->method('write')
Expand All @@ -176,7 +178,6 @@ public function testHandleErrorLoggingTrace() {
$this->stringContains('Trace:'),
$this->stringContains(__NAMESPACE__ . '\ErrorHandlerTest::testHandleErrorLoggingTrace()')
));
$this->_restoreError = true;

$out .= '';
}
Expand All @@ -203,7 +204,6 @@ public function testHandleException() {
*/
public function testHandleExceptionLog() {
$errorHandler = new ErrorHandler(['log' => true]);
$errorHandler->register();

$error = new Error\NotFoundException('Kaboom!');

Expand Down Expand Up @@ -240,7 +240,6 @@ public function testHandleExceptionLogSkipping() {
'log' => true,
'skipLog' => ['Cake\Error\NotFoundException']
]);
$errorHandler->register();

ob_start();
$errorHandler->handleException($notFound);
Expand Down Expand Up @@ -315,7 +314,7 @@ public function testHandleFatalErrorLog() {
$this->_logger->expects($this->at(0))
->method('write')
->with('error', $this->logicalAnd(
$this->stringContains(__FILE__ . ', line 328'),
$this->stringContains(__FILE__ . ', line 327'),
$this->stringContains('Fatal Error (1)'),
$this->stringContains('Something wrong')
));
Expand Down

0 comments on commit ecb9c71

Please sign in to comment.