File tree Expand file tree Collapse file tree 2 files changed +6
-17
lines changed
tests/TestCase/View/Helper Expand file tree Collapse file tree 2 files changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -1024,10 +1024,6 @@ public function input($fieldName, array $options = [])
1024
1024
$ options = $ this ->_parseOptions ($ fieldName , $ options );
1025
1025
$ options += ['id ' => $ this ->_domId ($ fieldName )];
1026
1026
1027
- if (strtolower ($ options ['type ' ]) === 'input ' ) {
1028
- throw new RuntimeException (sprintf ('Invalid type "input" used for field "%s" ' , $ fieldName ));
1029
- }
1030
-
1031
1027
$ templater = $ this ->templater ();
1032
1028
$ newTemplates = $ options ['templates ' ];
1033
1029
@@ -1140,7 +1136,7 @@ protected function _inputContainerTemplate($options)
1140
1136
*/
1141
1137
protected function _getInput ($ fieldName , $ options )
1142
1138
{
1143
- switch ($ options ['type ' ]) {
1139
+ switch (strtolower ( $ options ['type ' ]) ) {
1144
1140
case 'select ' :
1145
1141
$ opts = $ options ['options ' ];
1146
1142
unset($ options ['options ' ]);
@@ -1156,6 +1152,9 @@ protected function _getInput($fieldName, $options)
1156
1152
unset($ options ['options ' ]);
1157
1153
1158
1154
return $ this ->multiCheckbox ($ fieldName , $ opts , $ options );
1155
+ case 'input ' :
1156
+ throw new RuntimeException ("Invalid type 'input' used for field ' $ fieldName' " );
1157
+
1159
1158
default :
1160
1159
return $ this ->{$ options ['type ' ]}($ fieldName , $ options );
1161
1160
}
Original file line number Diff line number Diff line change @@ -3683,24 +3683,14 @@ public function testInputMagicSelectForTypeNumber()
3683
3683
* Test invalid 'input' type option to input() function.
3684
3684
*
3685
3685
* @expectedException \RuntimeException
3686
+ * @expectedExceptionMessage Invalid type 'input' used for field 'text'
3686
3687
* @return void
3687
3688
*/
3688
- public function testInvalidInputTypeOptionLowercase ()
3689
+ public function testInvalidInputTypeOption ()
3689
3690
{
3690
3691
$ this ->Form ->input ('text ' , ['type ' => 'input ' ]);
3691
3692
}
3692
3693
3693
- /**
3694
- * Test invalid 'Input' type option to input() function.
3695
- *
3696
- * @expectedException \RuntimeException
3697
- * @return void
3698
- */
3699
- public function testInvalidInputTypeOptionUppercase ()
3700
- {
3701
- $ this ->Form ->input ('text ' , ['type ' => 'Input ' ]);
3702
- }
3703
-
3704
3694
/**
3705
3695
* Test that magic input() selects can easily be converted into radio types without error.
3706
3696
*
You can’t perform that action at this time.
0 commit comments