Commit: 86bf9d1ff63eb00a893e0d14a13effb49216e0d3

Author: Nate Abele | Date: 2010-08-17 11:29:10 -0400
Tweaking exception messages in `\action\Controller`.
diff --git a/libraries/lithium/action/Controller.php b/libraries/lithium/action/Controller.php index 8ac9308..45ff93d 100644 --- a/libraries/lithium/action/Controller.php +++ b/libraries/lithium/action/Controller.php @@ -161,13 +161,10 @@ class Controller extends \lithium\core\Object { $result = null; if (substr($action, 0, 1) == '_' || method_exists(__CLASS__, $action)) { - throw new DispatchException('Private method!'); + throw new DispatchException('Attempted to invoke a private method.'); } if (!method_exists($self, $action)) { - throw new DispatchException("Action '{$action}' not found!"); - } - if (!method_exists($self, $action)) { - throw new Exception("Action '{$action}' not found!"); + throw new DispatchException("Action '{$action}' not found."); } $render['template'] = $render['template'] ?: $action; diff --git a/libraries/lithium/tests/cases/action/ControllerTest.php b/libraries/lithium/tests/cases/action/ControllerTest.php index 4f4d16d..737d84e 100644 --- a/libraries/lithium/tests/cases/action/ControllerTest.php +++ b/libraries/lithium/tests/cases/action/ControllerTest.php @@ -160,7 +160,7 @@ class ControllerTest extends \lithium\test\Unit { */ public function testProtectedMethodAccessAttempt() { $postsController = new MockPostsController(); - $this->expectException('/^Private/'); + $this->expectException('/^Attempted to invoke a private method/'); $result = $postsController->__invoke(null, array('action' => 'redirect')); $this->assertEqual($result->body, null); @@ -315,7 +315,7 @@ class ControllerTest extends \lithium\test\Unit { public function testNonExistentFunction() { $postsController = new MockPostsController(); - $this->expectException("Action 'foo' not found!"); + $this->expectException("Action 'foo' not found."); $postsController(new Request(), array('action' => 'foo')); } }