| @@ 158-172 (lines=15) @@ | ||
| 155 | } |
|
| 156 | ||
| 157 | /** @test */ |
|
| 158 | public function it_loads_values_from_the_request() |
|
| 159 | { |
|
| 160 | $request = $this->request(); |
|
| 161 | $request->method('all')->will($this->returnValue(['foo'=>'bar', 'register'=>true])); |
|
| 162 | $request->method('get')->will($this->returnValueMap([ |
|
| 163 | ['foo', 'bar'], |
|
| 164 | ['register', true], |
|
| 165 | ])); |
|
| 166 | ||
| 167 | $form = $this->form($request); |
|
| 168 | $form->text('foo'); |
|
| 169 | $form->button('register'); |
|
| 170 | ||
| 171 | $this->assertSame($form->get('foo'), 'bar'); |
|
| 172 | } |
|
| 173 | ||
| 174 | /** @test */ |
|
| 175 | public function it_loads_complex_values_from_the_request() |
|
| @@ 212-226 (lines=15) @@ | ||
| 209 | } |
|
| 210 | ||
| 211 | /** @test */ |
|
| 212 | public function it_only_loads_values_if_submitted() |
|
| 213 | { |
|
| 214 | $request = $this->request(); |
|
| 215 | $request->method('all')->will($this->returnValue(['foo'=>'bar', 'register'=>null])); |
|
| 216 | $request->method('get')->will($this->returnValueMap([ |
|
| 217 | ['foo', 'bar'], |
|
| 218 | ['register', null], |
|
| 219 | ])); |
|
| 220 | ||
| 221 | $form = $this->form($request); |
|
| 222 | $form->text('foo'); |
|
| 223 | $form->button('register'); |
|
| 224 | ||
| 225 | $this->assertSame($form->get('foo'), ''); |
|
| 226 | } |
|
| 227 | ||
| 228 | /** @test */ |
|
| 229 | public function it_is_valid_by_default() |
|