mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
2c061ede2b
commit
48f0131d50
1 changed files with 13 additions and 10 deletions
|
@ -26,6 +26,9 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* @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'));
|
App::import('Core', array('Error', 'Controller'));
|
||||||
|
|
||||||
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
||||||
|
@ -58,7 +61,7 @@ class TestErrorController extends TestAppController {
|
||||||
class ErrorHandlerTest extends UnitTestCase {
|
class ErrorHandlerTest extends UnitTestCase {
|
||||||
|
|
||||||
function skip() {
|
function skip() {
|
||||||
$this->skipif (false, 'ErrorHandlerTest not implemented');
|
$this->skipif ((php_sapi_name() == 'cli'), 'ErrorHandlerTest cannot be run from console');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testFromBeforeFilter() {
|
function testFromBeforeFilter() {
|
||||||
|
@ -110,11 +113,11 @@ class ErrorHandlerTest extends UnitTestCase {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
ob_start();
|
ob_start();
|
||||||
$ErrorHandler = new ErrorHandler('missingView', array(
|
$ErrorHandler = new ErrorHandler('missingView', array(
|
||||||
'className' => 'Pages',
|
'className' => 'Pages',
|
||||||
'action' => 'display',
|
'action' => 'display',
|
||||||
'file' => 'pages/about.ctp',
|
'file' => 'pages/about.ctp',
|
||||||
'base' => ''
|
'base' => ''
|
||||||
));
|
));
|
||||||
$expected = ob_get_clean();
|
$expected = ob_get_clean();
|
||||||
set_error_handler('simpleTestErrorHandler');
|
set_error_handler('simpleTestErrorHandler');
|
||||||
$this->assertPattern("/PagesController::/", $expected);
|
$this->assertPattern("/PagesController::/", $expected);
|
||||||
|
@ -126,10 +129,10 @@ class ErrorHandlerTest extends UnitTestCase {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
ob_start();
|
ob_start();
|
||||||
$ErrorHandler = new ErrorHandler('missingLayout', array(
|
$ErrorHandler = new ErrorHandler('missingLayout', array(
|
||||||
'layout' => 'my_layout',
|
'layout' => 'my_layout',
|
||||||
'file' => 'layouts/my_layout.ctp',
|
'file' => 'layouts/my_layout.ctp',
|
||||||
'base' => ''
|
'base' => ''
|
||||||
));
|
));
|
||||||
$expected = ob_get_clean();
|
$expected = ob_get_clean();
|
||||||
set_error_handler('simpleTestErrorHandler');
|
set_error_handler('simpleTestErrorHandler');
|
||||||
$this->assertPattern("/Missing Layout/", $expected);
|
$this->assertPattern("/Missing Layout/", $expected);
|
||||||
|
|
Loading…
Add table
Reference in a new issue