removing exit() and replace with $this->stop();

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7012 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-05-22 16:57:46 +00:00
parent ac9a96663d
commit aaab0306aa
18 changed files with 110 additions and 101 deletions

View file

@ -71,7 +71,7 @@ class ErrorHandler extends Object {
function error($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr($code . $name . $message."\n");
exit();
$this->stop();
}
/**
* Convenience method to display a 404 page.
@ -84,7 +84,7 @@ class ErrorHandler extends Object {
$this->error(array('code' => '404',
'name' => 'Not found',
'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message)));
exit();
$this->stop();
}
/**
* Renders the Missing Controller web page.
@ -96,7 +96,7 @@ class ErrorHandler extends Object {
extract($params, EXTR_OVERWRITE);
$controllerName = str_replace('Controller', '', $className);
$this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName));
exit();
$this->stop();
}
/**
* Renders the Missing Action web page.
@ -107,7 +107,7 @@ class ErrorHandler extends Object {
function missingAction($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className));
exit();
$this->stop();
}
/**
* Renders the Private Action web page.
@ -118,7 +118,7 @@ class ErrorHandler extends Object {
function privateAction($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className));
exit();
$this->stop();
}
/**
* Renders the Missing Table web page.
@ -129,7 +129,7 @@ class ErrorHandler extends Object {
function missingTable($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className));
exit();
$this->stop();
}
/**
* Renders the Missing Database web page.
@ -140,7 +140,7 @@ class ErrorHandler extends Object {
function missingDatabase($params = array()) {
extract($params, EXTR_OVERWRITE);
$this->stderr(__("Missing Database", true));
exit();
$this->stop();
}
/**
* Renders the Missing View web page.
@ -151,7 +151,7 @@ class ErrorHandler extends Object {
function missingView($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className));
exit();
$this->stop();
}
/**
* Renders the Missing Layout web page.
@ -162,7 +162,7 @@ class ErrorHandler extends Object {
function missingLayout($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Layout '%s'", true), $file));
exit();
$this->stop();
}
/**
* Renders the Database Connection web page.
@ -173,7 +173,7 @@ class ErrorHandler extends Object {
function missingConnection($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(__("Missing Database Connection. Try 'cake bake'", true));
exit();
$this->stop();
}
/**
* Renders the Missing Helper file web page.
@ -184,7 +184,7 @@ class ErrorHandler extends Object {
function missingHelperFile($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper)));
exit();
$this->stop();
}
/**
* Renders the Missing Helper class web page.
@ -195,7 +195,7 @@ class ErrorHandler extends Object {
function missingHelperClass($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file));
exit();
$this->stop();
}
/**
* Renders the Missing Component file web page.
@ -206,7 +206,7 @@ class ErrorHandler extends Object {
function missingComponentFile($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component)));
exit();
$this->stop();
}
/**
* Renders the Missing Component class web page.
@ -217,7 +217,7 @@ class ErrorHandler extends Object {
function missingComponentClass($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file));
exit();
$this->stop();
}
/**
* Renders the Missing Model class web page.
@ -228,7 +228,7 @@ class ErrorHandler extends Object {
function missingModel($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing model '%s'", true), $className));
exit();
$this->stop();
}
/**
* Outputs to the stdout filehandle.

View file

@ -85,7 +85,7 @@ class AclShell extends Shell {
$out .= sprintf(__("Current ACL Classname: %s", true), Configure::read('Acl.classname')) . "\n";
$out .= "--------------------------------------------------\n";
$this->err($out);
exit();
$this->stop();
}
if ($this->command && !in_array($this->command, array('help'))) {

View file

@ -94,7 +94,7 @@ class ApiShell extends Shell {
} else {
$this->err(sprintf(__("%s not found", true), $class));
exit();
$this->stop();
}
$parsed = $this->__parseClass($path . $file .'.php');
@ -103,7 +103,7 @@ class ApiShell extends Shell {
if (isset($this->params['m'])) {
if (!isset($parsed[$this->params['m']])) {
$this->err(sprintf(__("%s::%s() could not be found", true), $class, $this->params['m']));
exit();
$this->stop();
}
$method = $parsed[$this->params['m']];
$this->out($class .'::'.$method['method'] . $method['parameters']);
@ -122,7 +122,7 @@ class ApiShell extends Shell {
while ($number = $this->in(__('Select a number to see the more information about a specific method. q to quit. l to list.', true), null, 'q')) {
if ($number === 'q') {
$this->out(__('Done', true));
exit();
$this->stop();
}
if ($number === 'l') {
@ -193,7 +193,7 @@ class ApiShell extends Shell {
$File = new File($path);
if (!$File->exists()) {
$this->err(sprintf(__("%s could not be found", true), $File->name));
exit();
$this->stop();
}
$contents = $File->read();

View file

@ -55,7 +55,7 @@ class BakeShell extends Shell {
$this->{$task}->path = $this->params['working'] . DS . $path . DS;
if (!is_dir($this->{$task}->path)) {
$this->err(sprintf(__("%s directory could not be found.\nBe sure you have created %s", true), $task, $this->{$task}->path));
exit();
$this->stop();
}
}
}
@ -175,7 +175,7 @@ class BakeShell extends Shell {
if (empty($this->args)) {
$this->all();
}
exit();
$this->stop();
}
/**

View file

@ -27,7 +27,8 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('file', 'model' . DS . 'schema');
App::import('File')
App::import('Model', 'Schema');
/**
* Schema is a command-line database management utility for automating programmer chores.
*
@ -93,10 +94,10 @@ class SchemaShell extends Shell {
$File = new File($this->Schema->path . DS .'schema.php');
if ($File->exists()) {
$this->out($File->read());
exit();
$this->stop();
} else {
$this->err(__('Schema could not be found', true));
exit();
$this->stop();
}
}
/**
@ -121,7 +122,7 @@ class SchemaShell extends Shell {
$snapshot = true;
$result = $this->in("Schema file exists.\n [O]verwrite\n [S]napshot\n [Q]uit\nWould you like to do?", array('o', 's', 'q'), 's');
if ($result === 'q') {
exit();
$this->stop();
}
if ($result === 'o') {
$snapshot = false;
@ -147,10 +148,10 @@ class SchemaShell extends Shell {
if ($this->Schema->write($content)) {
$this->out(sprintf(__('Schema file: %s generated', true), $content['file']));
exit();
$this->stop();
} else {
$this->err(__('Schema file: %s generated', true));
exit();
$this->stop();
}
}
/**
@ -165,7 +166,7 @@ class SchemaShell extends Shell {
$Schema = $this->Schema->load();
if (!$Schema) {
$this->err(__('Schema could not be loaded', true));
exit();
$this->stop();
}
if (!empty($this->args[0])) {
if ($this->args[0] == 'true') {
@ -184,10 +185,10 @@ class SchemaShell extends Shell {
$File = new File($this->Schema->path . DS . $write, true);
if ($File->write($contents)) {
$this->out(sprintf(__('SQL dump file created in %s', true), $File->pwd()));
exit();
$this->stop();
} else {
$this->err(__('SQL dump could not be created', true));
exit();
$this->stop();
}
}
$this->out($contents);
@ -201,7 +202,7 @@ class SchemaShell extends Shell {
function run() {
if (!isset($this->args[0])) {
$this->err('command not found');
exit();
$this->stop();
}
$command = $this->args[0];
@ -227,7 +228,7 @@ class SchemaShell extends Shell {
if (!$Schema) {
$this->err(sprintf(__('%s could not be loaded', true), $this->Schema->file));
exit();
$this->stop();
}
$table = null;
@ -244,7 +245,7 @@ class SchemaShell extends Shell {
break;
default:
$this->err(__('command not found', true));
exit();
$this->stop();
}
}
/**
@ -269,7 +270,7 @@ class SchemaShell extends Shell {
}
if (empty($drop) || empty($create)) {
$this->out(__('Schema is up to date.', true));
exit();
$this->stop();
}
$this->out("\n" . __('The following tables will be dropped.', true));
@ -315,7 +316,7 @@ class SchemaShell extends Shell {
if (empty($contents)) {
$this->out(__('Schema is up to date.', true));
exit();
$this->stop();
}
$this->out("\n" . __('The following statements will run.', true));
@ -394,7 +395,7 @@ class SchemaShell extends Shell {
$this->out("\n\tschema run create <schema> <table>\n\t\tdrop tables and create database based on schema file\n\t\toptional <schema> arg for selecting schema name\n\t\toptional <table> arg for creating only one table\n\t\tpass the -s param with a number to use a snapshot\n\t\tTo see the changes, perform a dry run with the -dry param");
$this->out("\n\tschema run update <schema> <table>\n\t\talter tables based on schema file\n\t\toptional <schema> arg for selecting schema name.\n\t\toptional <table> arg for altering only one table.\n\t\tTo use a snapshot, pass the -s param with the snapshot number\n\t\tTo see the changes, perform a dry run with the -dry param");
$this->out("");
exit();
$this->stop();
}
}
?>

View file

@ -290,7 +290,7 @@ class Shell extends Object {
if (!isset($this->{$taskName})) {
$this->err("Task '".$taskName."' could not be loaded");
exit();
$this->stop();
}
}
}
@ -390,7 +390,7 @@ class Shell extends Object {
$out .= "$msg\n";
$out .= "\n";
$this->err($out);
exit();
$this->stop();
}
/**
* Will check the number args matches otherwise throw an error
@ -506,7 +506,7 @@ class Shell extends Object {
if ($this->Project->cakeAdmin($admin) !== true) {
$this->out('Unable to write to /app/config/core.php.');
$this->out('You need to enable Configure::write(\'Routing.admin\',\'admin\') in /app/config/core.php to use admin routing.');
exit();
$this->stop();
} else {
$cakeAdmin = $admin . '_';
}

View file

@ -287,7 +287,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else {
$actions .= "\t\t\t\t\$this->flash(__('{$currentModelName} saved.', true), array('action'=>'index'));\n";
$actions .= "\t\t\t\texit();\n";
$actions .= "\t\t\t\t\$this->stop();\n";
}
$actions .= "\t\t\t} else {\n";
if ($wannaUseSession) {
@ -327,7 +327,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else {
$actions .= "\t\t\t\$this->flash(__('Invalid {$singularHumanName}', true), array('action'=>'index'));\n";
$actions .= "\t\t\texit();\n";
$actions .= "\t\t\t\$this->stop();\n";
}
$actions .= "\t\t}\n";
$actions .= "\t\tif (!empty(\$this->data)) {\n";
@ -337,7 +337,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else {
$actions .= "\t\t\t\t\$this->flash(__('The ".$singularHumanName." has been saved.', true), array('action'=>'index'));\n";
$actions .= "\t\t\t\texit();\n";
$actions .= "\t\t\t\t\$this->stop();\n";
}
$actions .= "\t\t\t} else {\n";
if ($wannaUseSession) {
@ -511,7 +511,7 @@ class ControllerTask extends Shell {
if (empty($tables)) {
$this->err(__('Your database does not have any tables.', true));
exit();
$this->stop();
}
$this->__tables = $tables;
@ -541,7 +541,7 @@ class ControllerTask extends Shell {
if ($enteredController === 'q') {
$this->out(__("Exit", true));
exit();
$this->stop();
}
if ($enteredController == '' || intval($enteredController) > count($controllers)) {
@ -574,7 +574,7 @@ class ControllerTask extends Shell {
$this->out("\n\tcontroller <name> scaffold admin\n\t\tbakes a controller with scaffold actions for both public and Configure::read('Routing.admin')");
$this->out("\n\tcontroller <name> admin\n\t\tbakes a controller with scaffold actions only for Configure::read('Routing.admin')");
$this->out("");
exit();
$this->stop();
}
}
?>

View file

@ -71,7 +71,7 @@ class DbConfigTask extends Shell {
function execute() {
if (empty($this->args)) {
$this->__interactive();
exit();
$this->stop();
}
}
/**

View file

@ -154,7 +154,7 @@ class ExtractTask extends Shell{
$response = $this->in("What is the full path you would like to extract?\nExample: " . $this->params['root'] . DS . "myapp\n[Q]uit", null, 'Q');
if (strtoupper($response) === 'Q') {
$this->out('Extract Aborted');
exit();
$this->stop();
}
}
@ -179,7 +179,7 @@ class ExtractTask extends Shell{
$response = $this->in("What is the full path you would like to output?\nExample: " . $this->path . DS . "locale\n[Q]uit", null, $this->path . DS . "locale");
if (strtoupper($response) === 'Q') {
$this->out('Extract Aborted');
exit();
$this->stop();
}
}
@ -540,7 +540,7 @@ class ExtractTask extends Shell{
$response = $this->in("\n\nError: ".$file . ' already exists in this location. Overwrite?', array('y','n', 'q'), 'n');
if (strtoupper($response) === 'Q') {
$this->out('Extract Aborted');
exit();
$this->stop();
} elseif (strtoupper($response) === 'N') {
$response = '';
while ($response == '') {

View file

@ -754,7 +754,7 @@ class ModelTask extends Shell {
}
if (empty($tables)) {
$this->err(__('Your database does not have any tables.', true));
exit();
$this->stop();
}
$this->__tables = $tables;
@ -785,7 +785,7 @@ class ModelTask extends Shell {
if ($enteredModel === 'q') {
$this->out(__("Exit", true));
exit();
$this->stop();
}
if ($enteredModel == '' || intval($enteredModel) > count($this->_modelNames)) {
@ -815,7 +815,7 @@ class ModelTask extends Shell {
$this->out("\n\tmodel\n\t\tbakes model in interactive mode.");
$this->out("\n\tmodel <name>\n\t\tbakes model file with no associations or validation");
$this->out("");
exit();
$this->stop();
}
/**
* Builds the tests fixtures for the model and create the file

View file

@ -81,7 +81,7 @@ class PluginTask extends Shell {
$this->hr();
} elseif (isset($this->args[0])) {
$this->err(sprintf('%s in path %s not found.', $plugin, $this->path . $pluginPath));
exit();
$this->stop();
} else {
$this->__interactive($plugin);
}
@ -198,7 +198,7 @@ class PluginTask extends Shell {
$this->out("\n\tplugin <name> controller\n\t\tbakes controller. Run 'cake bake controller help' for more info.");
$this->out("\n\tplugin <name> view\n\t\tbakes view. Run 'cake bake view help' for more info.");
$this->out("");
exit();
$this->stop();
}
}
?>

View file

@ -288,7 +288,7 @@ class ProjectTask extends Shell {
$this->out('Commands:');
$this->out("\n\tproject <name>\n\t\tbakes app directory structure.\n\t\tif <name> begins with '/' path is absolute.");
$this->out("");
exit();
$this->stop();
}
}

View file

@ -128,7 +128,7 @@ class TestTask extends Shell {
}
}
} else {
exit();
$this->stop();
}
}
}

View file

@ -216,7 +216,7 @@ class ViewTask extends Shell {
$looksGood = $this->in('Look okay?', array('y','n'), 'y');
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
$this->bake($action);
exit();
$this->stop();
} else {
$this->out('Bake Aborted.');
}
@ -245,7 +245,7 @@ class ViewTask extends Shell {
if (!App::import('Controller', $import)) {
$file = $this->controllerPath . '_controller.php';
$this->err(sprintf(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", true), $file));
exit();
$this->stop();
}
$controllerClassName = $this->controllerName . 'Controller';
$controllerObj = & new $controllerClassName();
@ -362,7 +362,7 @@ class ViewTask extends Shell {
$this->out("\n\tview <controller> <action>\n\t\twill bake a template. core templates: (index, add, edit, view)");
$this->out("\n\tview <controller> <template> <alias>\n\t\twill use the template specified but name the file based on the alias");
$this->out("");
exit();
$this->stop();
}
/**
* Returns associations for controllers models.

View file

@ -128,7 +128,7 @@ class Dispatcher extends Object {
$this->here = $this->base . '/' . $url;
if ($this->cached($url)) {
exit();
$this->stop();
}
if ($parse) {
@ -659,10 +659,10 @@ class Dispatcher extends Object {
function cached($url) {
if (strpos($url, 'ccss/') === 0) {
include WWW_ROOT . DS . Configure::read('Asset.filter.css');
exit();
$this->stop();
} elseif (strpos($url, 'cjs/') === 0) {
include WWW_ROOT . DS . Configure::read('Asset.filter.js');
exit();
$this->stop();
}
$assets = array('js' => 'text/javascript', 'css' => 'text/css');

View file

@ -227,7 +227,7 @@ class RequestHandlerComponent extends Object {
$url = Router::url(array_merge(array('base' => false), $url));
}
echo $this->requestAction($url, array('return'));
exit();
$this->stop();
}
/**
* Returns true if the current HTTP request is Ajax, false otherwise

View file

@ -80,15 +80,13 @@ class ErrorHandler extends Object {
if ($method == 'error') {
$this->dispatchMethod($method, $messages);
exit();
$this->stop();
} elseif (Configure::read() == 0) {
$this->dispatchMethod('error404', $messages);
exit();
$this->stop();
} else {
$this->dispatchMethod($method, $messages);
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
exit();
}
$this->stop();
}
}
/**

View file

@ -26,7 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
if (class_exists('ErrorHandler')) {
if (class_exists('TestErrorHandler')) {
return;
}
App::import('Core', array('Error', 'Controller'));
@ -35,14 +35,18 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
if (!class_exists('TestAppController')) {
class TestAppController extends Controller {
function beforeFilter() {
$this->cakeError('error404', array('oops' => 'Nothing to see here'));
}
class TestErrorAppController extends Controller {
function beforeFilter() {
$this->cakeError('error404', array('oops' => 'Nothing to see here'));
}
function cakeError($method, $messages = array()) {
$error =& new TestErrorHandler($method, $messages);
return $error;
}
}
class TestErrorController extends TestAppController {
class TestErrorController extends TestErrorAppController {
var $uses = array();
@ -50,7 +54,13 @@ class TestErrorController extends TestAppController {
$this->autoRender = false;
return 'what up';
}
}
class TestErrorHandler extends ErrorHandler {
function stop() {
return;
}
}
/**
* Short description for class.
@ -58,10 +68,10 @@ class TestErrorController extends TestAppController {
* @package cake.tests
* @subpackage cake.tests.cases.libs
*/
class ErrorHandlerTest extends CakeTestCase {
class TestErrorHandlerTest extends CakeTestCase {
function skip() {
$this->skipif ((php_sapi_name() == 'cli'), 'ErrorHandlerTest cannot be run from console');
$this->skipif ((php_sapi_name() == 'cli'), 'TestErrorHandlerTest cannot be run from console');
}
function testFromBeforeFilter() {
@ -69,7 +79,7 @@ class ErrorHandlerTest extends CakeTestCase {
require CAKE . 'dispatcher.php';
}
$Dispatcher =& new Dispatcher();
restore_error_handler();
ob_start();
$controller = $Dispatcher->dispatch('/test_error', array('return'=> 1));
@ -81,41 +91,41 @@ class ErrorHandlerTest extends CakeTestCase {
function testError() {
ob_start();
$ErrorHandler = new ErrorHandler('error404', array('message' => 'Page not found'));
$TestErrorHandler = new TestErrorHandler('error404', array('message' => 'Page not found'));
ob_clean();
ob_start();
$ErrorHandler->error(array(
$TestErrorHandler->error(array(
'code' => 404,
'message' => 'Page not Found',
'name' => "Couldn't find what you were looking for"
));
$result = ob_get_clean();
$result = ob_get_clean();
$this->assertPattern("/<h2>Couldn't find what you were looking for<\/h2>/", $result);
$this->assertPattern('/Page not Found/', $result);
$this->assertPattern('/Page not Found/', $result);
}
function testError404() {
ob_start();
$ErrorHandler = new ErrorHandler('error404', array('message' => 'Page not found'));
$TestErrorHandler = new TestErrorHandler('error404', array('message' => 'Page not found'));
$result = ob_get_clean();
$this->assertPattern('/<h2>Not Found<\/h2>/', $result);
$this->assertPattern("/<strong>'\/test_error'<\/strong>/", $result);
}
function testMissingController() {
function testMissingController() {
ob_start();
$ErrorHandler = new ErrorHandler('missingController', array(
$TestErrorHandler = new TestErrorHandler('missingController', array(
'className' => 'PostsController'
));
$result = ob_get_clean();
$this->assertPattern('/<h2>Missing Controller<\/h2>/', $result);
$this->assertPattern('/<em>PostsController<\/em>/', $result);
}
function testMissingAction() {
ob_start();
$ErrorHandler = new ErrorHandler('missingAction', array(
$TestErrorHandler = new TestErrorHandler('missingAction', array(
'className' => 'PostsController',
'action' => 'index'
));
@ -126,7 +136,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testPrivateAction() {
ob_start();
$ErrorHandler = new ErrorHandler('privateAction', array(
$TestErrorHandler = new TestErrorHandler('privateAction', array(
'className' => 'PostsController',
'action' => '_secretSauce'
));
@ -137,7 +147,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingTable() {
ob_start();
$ErrorHandler = new ErrorHandler('missingTable', array(
$TestErrorHandler = new TestErrorHandler('missingTable', array(
'className' => 'Article',
'table' => 'articles'
));
@ -148,7 +158,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingDatabase() {
ob_start();
$ErrorHandler = new ErrorHandler('missingDatabase', array());
$TestErrorHandler = new TestErrorHandler('missingDatabase', array());
$result = ob_get_clean();
$this->assertPattern('/<h2>Missing Database Connection<\/h2>/', $result);
$this->assertPattern('/Confirm you have created the file/', $result);
@ -157,7 +167,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingView() {
restore_error_handler();
ob_start();
$ErrorHandler = new ErrorHandler('missingView', array(
$TestErrorHandler = new TestErrorHandler('missingView', array(
'className' => 'Pages',
'action' => 'display',
'file' => 'pages/about.ctp',
@ -173,7 +183,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingLayout() {
restore_error_handler();
ob_start();
$ErrorHandler = new ErrorHandler('missingLayout', array(
$TestErrorHandler = new TestErrorHandler('missingLayout', array(
'layout' => 'my_layout',
'file' => 'layouts/my_layout.ctp',
'base' => ''
@ -187,7 +197,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingConnection() {
ob_start();
$ErrorHandler = new ErrorHandler('missingConnection', array(
$TestErrorHandler = new TestErrorHandler('missingConnection', array(
'className' => 'Article'
));
$result = ob_get_clean();
@ -197,7 +207,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingHelperFile() {
ob_start();
$ErrorHandler = new ErrorHandler('missingHelperFile', array(
$TestErrorHandler = new TestErrorHandler('missingHelperFile', array(
'helper' => 'MyCustom',
'file' => 'my_custom.php'
));
@ -209,19 +219,19 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingHelperClass() {
ob_start();
$ErrorHandler = new ErrorHandler('missingHelperClass', array(
$TestErrorHandler = new TestErrorHandler('missingHelperClass', array(
'helper' => 'MyCustom',
'file' => 'my_custom.php'
));
$result = ob_get_clean();
$this->assertPattern('/<h2>Missing Helper Class<\/h2>/', $result);
$this->assertPattern('/The helper class <em>MyCustomHelper<\/em> can not be found or does not exist./', $result);
$this->assertPattern('/\/my_custom.php/', $result);
$this->assertPattern('/\/my_custom.php/', $result);
}
function testMissingComponentFile() {
ob_start();
$ErrorHandler = new ErrorHandler('missingComponentFile', array(
$TestErrorHandler = new TestErrorHandler('missingComponentFile', array(
'className' => 'PostsController',
'component' => 'Sidebox',
'file' => 'sidebox.php'
@ -234,7 +244,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingComponentClass() {
ob_start();
$ErrorHandler = new ErrorHandler('missingComponentClass', array(
$TestErrorHandler = new TestErrorHandler('missingComponentClass', array(
'className' => 'PostsController',
'component' => 'Sidebox',
'file' => 'sidebox.php'
@ -247,7 +257,7 @@ class ErrorHandlerTest extends CakeTestCase {
function testMissingModel() {
ob_start();
$ErrorHandler = new ErrorHandler('missingModel', array(
$TestErrorHandler = new TestErrorHandler('missingModel', array(
'className' => 'Article',
'file' => 'article.php'
));