File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,36 @@ public function testCallPostWithBody()
102102 $ response ->assertSee ('Hello Mars! ' );
103103 }
104104
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+
105135 public function testCallPut ()
106136 {
107137 $ this ->withRoutes ([
You can’t perform that action at this time.
0 commit comments