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
This commit is contained in:
gwoo 2008-05-01 05:37:19 +00:00
parent 2c061ede2b
commit 48f0131d50

View file

@ -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);