mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Using plugin name on exception thrown and in templates files.
This commit is contained in:
parent
229bf8e984
commit
573a349209
11 changed files with 29 additions and 17 deletions
|
@ -116,7 +116,8 @@ class BehaviorCollection extends ObjectCollection {
|
|||
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 @@ class ConnectionManager {
|
|||
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 @@ class Dispatcher {
|
|||
|
||||
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 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
* @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,7 +508,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
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
|
||||
),
|
||||
|
@ -516,6 +516,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
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 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
}
|
||||
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>
|
||||
<?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>
|
||||
<?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>
|
||||
<?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>
|
||||
<?php
|
||||
|
|
|
@ -74,7 +74,8 @@ class HelperCollection extends ObjectCollection {
|
|||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue