This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-5
lines changed
library/Zend/Controller/Action/Helper
tests/Zend/Controller/Action/Helper Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -841,14 +841,21 @@ protected function _translateSpec(array $vars = array())
841
841
$ inflector = $ this ->getInflector ();
842
842
$ request = $ this ->getRequest ();
843
843
$ dispatcher = $ this ->getFrontController ()->getDispatcher ();
844
- $ module = $ dispatcher ->formatModuleName ($ request ->getModuleName ());
845
- $ controller = $ dispatcher ->formatControllerName (
846
- $ request ->getControllerName ()
847
- );
844
+
845
+ // Format module name
846
+ $ module = $ dispatcher ->formatModuleName ($ request ->getModuleName ());
847
+
848
+ // Format controller name
849
+ require_once 'Zend/Filter/Word/CamelCaseToDash.php ' ;
850
+ $ filter = new Zend_Filter_Word_CamelCaseToDash ();
851
+ $ controller = $ filter ->filter ($ request ->getControllerName ());
852
+ $ controller = $ dispatcher ->formatControllerName ($ controller );
848
853
if ('Controller ' == substr ($ controller , -10 )) {
849
854
$ controller = substr ($ controller , 0 , -10 );
850
855
}
851
- $ action = $ dispatcher ->formatActionName ($ request ->getActionName ());
856
+
857
+ // Format action name
858
+ $ action = $ dispatcher ->formatActionName ($ request ->getActionName ());
852
859
853
860
$ params = compact ('module ' , 'controller ' , 'action ' );
854
861
foreach ($ vars as $ key => $ value ) {
Original file line number Diff line number Diff line change @@ -938,6 +938,25 @@ public function providerControllerNameDoesNotIncludeDisallowedCharacters()
938
938
);
939
939
}
940
940
941
+ /**
942
+ * @group GH-440
943
+ */
944
+ public function testControllerNameFormattingShouldRespectWordCamelCaseToDash ()
945
+ {
946
+ $ this ->request ->setControllerName ('MetadataValidation ' )
947
+ ->setActionName ('index ' );
948
+
949
+ $ this ->helper ->setActionController (
950
+ new Bar_IndexController (
951
+ $ this ->request , $ this ->response , array ()
952
+ )
953
+ );
954
+
955
+ $ this ->assertEquals (
956
+ 'metadata-validation/index.phtml ' , $ this ->helper ->getViewScript ()
957
+ );
958
+ }
959
+
941
960
protected function _normalizePath ($ path )
942
961
{
943
962
return str_replace (array ('/ ' , '\\' ), '/ ' , $ path );
You can’t perform that action at this time.
0 commit comments