Skip to content
Permalink
Browse files

Using plugin name on exception thrown and in templates files.

  • Loading branch information...
renan committed Oct 16, 2011
1 parent 229bf8e commit 573a34920987bdf6ac7bf5315d19897a6012fad6
@@ -116,7 +116,8 @@ public function load($behavior, $config = array()) {
App::uses($class, $plugin . 'Model/Behavior');
if (!class_exists($class)) {
throw new MissingBehaviorException(array(
'class' => $class
'class' => $class,
'plugin' => substr($plugin, 0, -1)
));
}
@@ -170,7 +170,7 @@ public static function loadDataSource($connName) {
if (!class_exists($conn['classname'])) {
throw new MissingDatasourceException(array(
'class' => $conn['classname'],
'plugin' => $plugin
'plugin' => substr($plugin, 0, -1)
));
}
return true;
@@ -81,7 +81,8 @@ public function dispatch(CakeRequest $request, CakeResponse $response, $addition
if (!($controller instanceof Controller)) {
throw new MissingControllerException(array(
'controller' => Inflector::camelize($request->params['controller']) . 'Controller'
'class' => Inflector::camelize($request->params['controller']) . 'Controller',
'plugin' => empty($request->params['controller']) ? null : Inflector::camelize($request->params['plugin'])
));
}
@@ -423,7 +423,7 @@ public function testError500Message() {
* @return void
*/
public function testMissingController() {
$exception = new MissingControllerException(array('controller' => 'PostsController'));
$exception = new MissingControllerException(array('class' => 'PostsController'));
$ExceptionRenderer = $this->_mockResponse(new ExceptionRenderer($exception));
ob_start();
@@ -508,14 +508,15 @@ public static function testProvider() {
new MissingDatasourceException(array('class' => 'MyDatasource', 'plugin' => 'MyPlugin')),
array(
'/<h2>Missing Datasource<\/h2>/',
'/Datasource class <em>MyDatasource<\/em> could not be found/'
'/Datasource class <em>MyPlugin.MyDatasource<\/em> could not be found/'
),
500
),
array(
new MissingHelperException(array('class' => 'MyCustomHelper')),
array(
'/<h2>Missing Helper<\/h2>/',
'/<em>MyCustomHelper<\/em> could not be found./',
'/Create the class <em>MyCustomHelper<\/em> below in file:/',
'/(\/|\\\)MyCustomHelper.php/'
),
@@ -272,7 +272,10 @@ public function generate($controller, $mocks = array()) {
}
App::uses($controller . 'Controller', $plugin . 'Controller');
if (!class_exists($controller.'Controller')) {
throw new MissingControllerException(array('controller' => $controller.'Controller'));
throw new MissingControllerException(array(
'class' => $controller . 'Controller',
'plugin' => substr($plugin, 0, -1)
));
}
ClassRegistry::flush();
@@ -15,15 +15,16 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$pluginDot = empty($plugin) ? null : $plugin . '.';
?>
<h2><?php echo __d('cake_dev', 'Missing Behavior'); ?></h2>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $class . '</em>'); ?>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?>
</p>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'Model' . DS . 'Behavior' . DS . $class . '.php'); ?>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Model' . DS . 'Behavior' . DS . $class . '.php'); ?>
</p>
<pre>
&lt;?php
@@ -15,15 +15,16 @@
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$pluginDot = empty($plugin) ? null : $plugin . '.';
?>
<h2><?php echo __d('cake_dev', 'Missing Component'); ?></h2>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $class . '</em>'); ?>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?>
</p>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'Controller' . DS . 'Component' . DS . $class . '.php'); ?>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Controller' . DS . 'Component' . DS . $class . '.php'); ?>
</p>
<pre>
&lt;?php
@@ -15,19 +15,20 @@
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$pluginDot = empty($plugin) ? null : $plugin . '.';
?>
<h2><?php echo __d('cake_dev', 'Missing Controller'); ?></h2>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $controller . '</em>'); ?>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?>
</p>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $controller . '</em>', APP_DIR . DS . 'Controller' . DS . $controller . '.php'); ?>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Controller' . DS . $class . '.php'); ?>
</p>
<pre>
&lt;?php
class <?php echo $controller; ?> extends AppController {
class <?php echo $class; ?> extends AppController {

}
</pre>
@@ -15,11 +15,12 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$pluginDot = empty($plugin) ? null : $plugin . '.';
?>
<h2><?php echo __d('cake_dev', 'Missing Datasource'); ?></h2>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Datasource class %s could not be found.', '<em>' . $class . '</em>'); ?>
<?php echo __d('cake_dev', 'Datasource class %s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?>
</p>
<p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
@@ -15,15 +15,16 @@
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$pluginDot = empty($plugin) ? null : $plugin . '.';
?>
<h2><?php echo __d('cake_dev', 'Missing Helper'); ?></h2>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $class . '</em>'); ?>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?>
</p>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'View' . DS . 'Helper' . DS . $class . '.php'); ?>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'View' . DS . 'Helper' . DS . $class . '.php'); ?>
</p>
<pre>
&lt;?php
@@ -74,7 +74,8 @@ public function load($helper, $settings = array()) {
App::uses($helperClass, $plugin . 'View/Helper');
if (!class_exists($helperClass)) {
throw new MissingHelperException(array(
'class' => $helperClass
'class' => $helperClass,
'plugin' => substr($plugin, 0, -1)
));
}
$this->_loaded[$alias] = new $helperClass($this->_View, $settings);

0 comments on commit 573a349

Please sign in to comment.
You can’t perform that action at this time.