| @@ 140-155 (lines=16) @@ | ||
| 137 | } |
|
| 138 | ||
| 139 | /** @test */ |
|
| 140 | public function it_can_detect_which_submit_button_was_clicked() |
|
| 141 | { |
|
| 142 | $request = $this->request(); |
|
| 143 | $request->method('get')->will($this->returnValueMap([ |
|
| 144 | ['foo', null], |
|
| 145 | ['bar', true], |
|
| 146 | ]) |
|
| 147 | ); |
|
| 148 | ||
| 149 | $form = $this->form($request); |
|
| 150 | $form->button('foo'); |
|
| 151 | $form->button('bar'); |
|
| 152 | ||
| 153 | $this->assertFalse($form->submitted('foo')); |
|
| 154 | $this->assertTrue($form->submitted('bar')); |
|
| 155 | } |
|
| 156 | ||
| 157 | /** @test */ |
|
| 158 | public function it_loads_values_from_the_request() |
|
| @@ 261-274 (lines=14) @@ | ||
| 258 | } |
|
| 259 | ||
| 260 | /** @test */ |
|
| 261 | public function it_renders_errors() |
|
| 262 | { |
|
| 263 | $request = $this->request(); |
|
| 264 | $request->method('get')->will($this->returnValueMap([ |
|
| 265 | ['foo', ''], |
|
| 266 | ['register', true], |
|
| 267 | ])); |
|
| 268 | ||
| 269 | $form = $this->form($request); |
|
| 270 | $form->text('foo')->required(); |
|
| 271 | $form->button('register'); |
|
| 272 | ||
| 273 | $this->assertContains('<p class="error_message">', $form->render()); |
|
| 274 | } |
|
| 275 | ||
| 276 | /** @test */ |
|
| 277 | public function it_renders_default_language() |
|