From 48f0131d5040e7139a4df2ed0387530142b18f3a Mon Sep 17 00:00:00 2001 From: gwoo Date: Thu, 1 May 2008 05:37:19 +0000 Subject: [PATCH] closes #4552, error test disabled when run from console git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6740 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/libs/error.test.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cake/tests/cases/libs/error.test.php b/cake/tests/cases/libs/error.test.php index 9425b933c..cf35157e9 100644 --- a/cake/tests/cases/libs/error.test.php +++ b/cake/tests/cases/libs/error.test.php @@ -26,6 +26,9 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ +if (class_exists('ErrorHandler')) { + return; +} App::import('Core', array('Error', 'Controller')); if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { @@ -58,7 +61,7 @@ class TestErrorController extends TestAppController { class ErrorHandlerTest extends UnitTestCase { function skip() { - $this->skipif (false, 'ErrorHandlerTest not implemented'); + $this->skipif ((php_sapi_name() == 'cli'), 'ErrorHandlerTest cannot be run from console'); } function testFromBeforeFilter() { @@ -110,11 +113,11 @@ class ErrorHandlerTest extends UnitTestCase { restore_error_handler(); ob_start(); $ErrorHandler = new ErrorHandler('missingView', array( - 'className' => 'Pages', - 'action' => 'display', - 'file' => 'pages/about.ctp', - 'base' => '' - )); + 'className' => 'Pages', + 'action' => 'display', + 'file' => 'pages/about.ctp', + 'base' => '' + )); $expected = ob_get_clean(); set_error_handler('simpleTestErrorHandler'); $this->assertPattern("/PagesController::/", $expected); @@ -126,10 +129,10 @@ class ErrorHandlerTest extends UnitTestCase { restore_error_handler(); ob_start(); $ErrorHandler = new ErrorHandler('missingLayout', array( - 'layout' => 'my_layout', - 'file' => 'layouts/my_layout.ctp', - 'base' => '' - )); + 'layout' => 'my_layout', + 'file' => 'layouts/my_layout.ctp', + 'base' => '' + )); $expected = ob_get_clean(); set_error_handler('simpleTestErrorHandler'); $this->assertPattern("/Missing Layout/", $expected);