File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
lib/Cake/Test/Case/View/Helper Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -8007,6 +8007,32 @@ public function testFormInputRequiredDetection() {
8007
8007
);
8008
8008
$ this ->assertTags ($ result , $ expected );
8009
8009
}
8010
+
8011
+ /**
8012
+ * Test that required fields are created when only using ModelValidator::add().
8013
+ *
8014
+ * @return void
8015
+ */
8016
+ public function testFormInputRequiredDetectionModelValidator () {
8017
+ ClassRegistry::getObject ('ContactTag ' )->validator ()->add ('iwillberequired ' , 'required ' , array ('rule ' => 'notEmpty ' ));
8018
+
8019
+ $ this ->Form ->create ('ContactTag ' );
8020
+ $ result = $ this ->Form ->input ('ContactTag.iwillberequired ' );
8021
+ $ expected = array (
8022
+ 'div ' => array ('class ' => 'input text required ' ),
8023
+ 'label ' => array ('for ' => 'ContactTagIwillberequired ' ),
8024
+ 'Iwillberequired ' ,
8025
+ '/label ' ,
8026
+ 'input ' => array (
8027
+ 'name ' => 'data[ContactTag][iwillberequired] ' ,
8028
+ 'type ' => 'text ' ,
8029
+ 'id ' => 'ContactTagIwillberequired ' ,
8030
+ 'required ' => 'required '
8031
+ ),
8032
+ '/div '
8033
+ );
8034
+ $ this ->assertTags ($ result , $ expected );
8035
+ }
8010
8036
8011
8037
/**
8012
8038
* testFormMagicInput method
You can’t perform that action at this time.
0 commit comments