File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ public function apply(array $data)
131
131
if ($ this ->antiCsrf && ! $ this ->antiCsrf ->isValid ($ data )) {
132
132
throw new CsrfViolationException ;
133
133
}
134
+ $ this ->fill ($ data );
134
135
$ isValid = $ this ->filter ->apply ($ data );
135
136
136
137
return $ isValid ;
Original file line number Diff line number Diff line change @@ -43,5 +43,17 @@ public function testError()
43
43
$ this ->assertFalse ($ isValid );
44
44
$ error = $ this ->form ->error ('name ' );
45
45
$ this ->assertSame ('Name must be alphabetic only. ' , $ error );
46
+ $ html = (string ) $ this ->form ;
47
+
48
+ return $ html ;
49
+ }
50
+
51
+ /**
52
+ * @depends testError
53
+ */
54
+ public function tesetInputDataReamainedOnValidationFailure ($ html )
55
+ {
56
+ $ expected = '<input id="name" type="text" name="name" value="@invalid@" /> ' ;
57
+ $ this ->assertContains ($ expected , $ html );
46
58
}
47
59
}
Original file line number Diff line number Diff line change @@ -44,24 +44,8 @@ public function __toString()
44
44
{
45
45
$ form = $ this ->form ();
46
46
// name
47
- $ form .= $ this ->helper ->tag ('div ' , ['class ' => 'form-group ' ]);
48
- $ form .= $ this ->helper ->tag ('label ' , ['for ' => 'name ' ]);
49
- $ form .= 'Name: ' ;
50
- $ form .= $ this ->helper ->tag ('/label ' ) . PHP_EOL ;
51
47
$ form .= $ this ->input ('name ' );
52
48
$ form .= $ this ->error ('name ' );
53
- $ form .= $ this ->helper ->tag ('/div ' ) . PHP_EOL ;
54
- // message
55
- $ form .= $ this ->helper ->tag ('div ' , ['class ' => 'form-group ' ]);
56
- $ form .= $ this ->helper ->tag ('label ' , ['for ' => 'message ' ]);
57
- $ form .= 'Message: ' ;
58
- $ form .= $ this ->helper ->tag ('/label ' ) . PHP_EOL ;
59
- $ form .= $ this ->input ('message ' );
60
- $ form .= $ this ->error ('message ' );
61
- $ form .= $ this ->helper ->tag ('/div ' ) . PHP_EOL ;
62
- // submit
63
- $ form .= $ this ->input ('submit ' );
64
- $ form .= $ this ->helper ->tag ('/form ' );
65
49
66
50
return $ form ;
67
51
}
You can’t perform that action at this time.
0 commit comments