File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,36 @@ public function testCallPostWithBody()
102
102
$ response ->assertSee ('Hello Mars! ' );
103
103
}
104
104
105
+ public function testCallValidationTwice ()
106
+ {
107
+ $ this ->withRoutes ([
108
+ [
109
+ 'post ' ,
110
+ 'section/create ' ,
111
+ static function () {
112
+ $ validation = Services::validation ();
113
+ $ validation ->setRule ('title ' , 'title ' , 'required|min_length[3] ' );
114
+
115
+ $ post = Services::request ()->getPost ();
116
+
117
+ if ($ validation ->run ($ post )) {
118
+ return 'Okay ' ;
119
+ }
120
+
121
+ return 'Invalid ' ;
122
+ },
123
+ ],
124
+ ]);
125
+
126
+ $ response = $ this ->post ('section/create ' , ['foo ' => 'Mars ' ]);
127
+
128
+ $ response ->assertSee ('Invalid ' );
129
+
130
+ $ response = $ this ->post ('section/create ' , ['title ' => 'Section Title ' ]);
131
+
132
+ $ response ->assertSee ('Okay ' );
133
+ }
134
+
105
135
public function testCallPut ()
106
136
{
107
137
$ this ->withRoutes ([
You can’t perform that action at this time.
0 commit comments