|
|
@@ -77,6 +77,15 @@ class Zend_Controller_Dispatcher_StandardTest extends PHPUnit_Framework_TestCase
|
|
|
unset($this->_dispatcher);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @group ZF-9800
|
|
|
+ */
|
|
|
+ public function testFormatModuleName()
|
|
|
+ {
|
|
|
+ $this->assertEquals('Test', $this->_dispatcher->formatModuleName('test'));
|
|
|
+ $this->assertEquals('TestFoo', $this->_dispatcher->formatModuleName('test-foo'));
|
|
|
+ }
|
|
|
+
|
|
|
public function testFormatControllerName()
|
|
|
{
|
|
|
$this->assertEquals('IndexController', $this->_dispatcher->formatControllerName('index'));
|
|
|
@@ -471,7 +480,7 @@ class Zend_Controller_Dispatcher_StandardTest extends PHPUnit_Framework_TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @see ZF-3034
|
|
|
+ * @group ZF-3034
|
|
|
*/
|
|
|
public function testIsValidModuleShouldNormalizeModuleName()
|
|
|
{
|
|
|
@@ -535,6 +544,42 @@ class Zend_Controller_Dispatcher_StandardTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertTrue(class_exists($test));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @group ZF-9800
|
|
|
+ */
|
|
|
+ public function testLoadClassLoadsControllerInSpecifiedModuleWithHyphenatedModuleName()
|
|
|
+ {
|
|
|
+ $front = Zend_Controller_Front::getInstance();
|
|
|
+ $front->addModuleDirectory(dirname(__FILE__) . '/../_files/modules');
|
|
|
+ $dispatcher = $front->getDispatcher();
|
|
|
+
|
|
|
+ $request = new Zend_Controller_Request_Simple();
|
|
|
+ $request->setControllerName('foo')
|
|
|
+ ->setModuleName('baz-bat');
|
|
|
+ $class = $dispatcher->getControllerClass($request);
|
|
|
+ $this->assertEquals('FooController', $class);
|
|
|
+ $test = $dispatcher->loadClass($class);
|
|
|
+ $this->assertEquals('BazBat_FooController', $test);
|
|
|
+ $this->assertTrue(class_exists($test));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @group ZF-9800
|
|
|
+ */
|
|
|
+ public function testDispatcherCanDispatchControllersFromModuleWithHyphenatedName()
|
|
|
+ {
|
|
|
+ $front = Zend_Controller_Front::getInstance();
|
|
|
+ $front->addModuleDirectory(dirname(__FILE__) . '/../_files/modules');
|
|
|
+ $dispatcher = $front->getDispatcher();
|
|
|
+
|
|
|
+ $request = new Zend_Controller_Request_Simple();
|
|
|
+ $request->setModuleName('baz-bat')->setControllerName('foo');
|
|
|
+ $response = new Zend_Controller_Response_Cli();
|
|
|
+ $dispatcher->dispatch($request, $response);
|
|
|
+ $body = $dispatcher->getResponse()->getBody();
|
|
|
+ $this->assertContains("BazBat_FooController::indexAction() called", $body, $body);
|
|
|
+ }
|
|
|
+
|
|
|
public function testLoadClassLoadsControllerInDefaultModuleWithModulePrefixWhenRequested()
|
|
|
{
|
|
|
Zend_Controller_Front::getInstance()
|