File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -965,6 +965,35 @@ public function seeAuthentication($remembered = false)
965965 $ this ->assertTrue ($ security ->isGranted ($ role ), 'There is no authenticated user ' );
966966 }
967967
968+ /**
969+ * Submits the given Symfony Form on the page, with the given form values.
970+ * If you customized the CSS selectors or field names use ->submitForm() instead.
971+ *
972+ * ```php
973+ * <?php
974+ * $I->submitSymfonyForm('login_form', [
975+ * '[email]' => 'john_doe@gmail.com',
976+ * '[password]' => 'secretForest'
977+ * ]);
978+ * ```
979+ *
980+ * @param string $name
981+ * @param string[] $fields
982+ */
983+ public function submitSymfonyForm ($ name , $ fields )
984+ {
985+ $ selector = sprintf ('form[name=%s] ' , $ name );
986+
987+ $ params = [];
988+ foreach ($ fields as $ key => $ value ) {
989+ $ fixedKey = sprintf ('%s%s ' , $ name , $ key );
990+ $ params [$ fixedKey ] = $ value ;
991+ }
992+ $ button = sprintf ('%s_submit ' , $ name );
993+
994+ $ this ->submitForm ($ selector , $ params , $ button );
995+ }
996+
968997 /**
969998 * Check that the current user has a role
970999 *
You can’t perform that action at this time.
0 commit comments