Skip to content

Commit

Permalink
Fix failing tests.
Browse files Browse the repository at this point in the history
Two buffers are needed now that handleFatalError() is blowing one up.
Related to pull request #1158
  • Loading branch information
markstory committed Feb 25, 2013
1 parent b24af5c commit 3d0920a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Cake/Test/Case/Error/ErrorHandlerTest.php
Expand Up @@ -252,14 +252,16 @@ public function testLoadPluginHandler() {
/**
* test handleFatalError generating a page.
*
* These tests start two buffers as handleFatalError blows the outer one up.
*
* @return void
*/
public function testHandleFatalErrorPage() {
$this->skipIf(file_exists(APP . 'app_error.php'), 'App error exists cannot run.');

$originalDebugLevel = Configure::read('debug');
$line = __LINE__;

ob_start();
ob_start();
Configure::write('debug', 1);
ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, $line);
Expand All @@ -268,15 +270,14 @@ public function testHandleFatalErrorPage() {
$this->assertContains(__FILE__, $result, 'filename missing.');
$this->assertContains((string)$line, $result, 'line missing.');

ob_start();
ob_start();
Configure::write('debug', 0);
ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, $line);
$result = ob_get_clean();
$this->assertNotContains('Something wrong', $result, 'message must not appear.');
$this->assertNotContains(__FILE__, $result, 'filename must not appear.');
$this->assertContains('An Internal Error Has Occurred', $result);

Configure::write('debug', $originalDebugLevel);
}

/**
Expand Down

0 comments on commit 3d0920a

Please sign in to comment.