Index: StandardTest.php =================================================================== --- StandardTest.php (revision 7916) +++ StandardTest.php (working copy) @@ -382,12 +382,43 @@ $this->assertContains("Foo_Admin_IndexController::indexAction() called", $body, $body); } - public function testDefaultModule() + public function testDefaultModuleThatExists() { $this->assertEquals('default', $this->_dispatcher->getDefaultModule()); - $this->_dispatcher->setDefaultModule('foobar'); - $this->assertEquals('foobar', $this->_dispatcher->getDefaultModule()); + $this->_dispatcher->setDefaultModule('admin'); + $this->assertEquals('admin', $this->_dispatcher->getDefaultModule()); + + $request = new Zend_Controller_Request_Http(); + $request->setControllerName('index'); + + $this->assertEquals('IndexController',$this->_dispatcher->getControllerClass($request)); } + + public function testDefaultModuleThatDoesNotExist() + { + $this->assertEquals('default', $this->_dispatcher->getDefaultModule()); + $moduleNotExist = 'shouldnotexist'; + $request = new Zend_Controller_Request_Http(); + $request->setControllerName('index'); // or anything else + $this->_dispatcher->setDefaultModule($moduleNotExist); + + try{ + $this->_dispatcher->getControllerClass($request); + $this->fail('Zend_Controller_Dispatcher_Exception expected'); + }catch(Zend_Exception $e){ + $this->assertType('Zend_Controller_Dispatcher_Exception',$e,' + Zend_Controller_Dispatcher_Exception expected, got ' .get_class($e)); + } + + try{ + $this->_dispatcher->getDefaultControllerClass($request); + $this->fail('Zend_Controller_Dispatcher_Exception expected'); + }catch(Zend_Exception $e){ + $this->assertType('Zend_Controller_Dispatcher_Exception',$e,' + Zend_Controller_Dispatcher_Exception expected, got ' .get_class($e)); + } + + } public function testModuleValid() {