| @@ 45-63 (lines=19) @@ | ||
| 42 | } |
|
| 43 | ||
| 44 | /** @test */ |
|
| 45 | public function it_can_fill_model_values_using_request() |
|
| 46 | { |
|
| 47 | $model = $this->model(['foo'=>'']); |
|
| 48 | ||
| 49 | $request = $this->request(); |
|
| 50 | $request->method('all')->will($this->returnValue(['foo'=>'bar', 'baz'=>true])); |
|
| 51 | $request->method('get')->will($this->returnValueMap([ |
|
| 52 | ['foo', 'bar'], |
|
| 53 | ['baz', true], |
|
| 54 | ])); |
|
| 55 | ||
| 56 | $form = $this->form($request); |
|
| 57 | $form->password('foo'); |
|
| 58 | $form->button('baz'); |
|
| 59 | ||
| 60 | $form->fill($model); |
|
| 61 | ||
| 62 | $this->assertNotEmpty($model->foo); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** @test */ |
|
| 66 | public function it_encrypts_passwords_automatically() |
|
| @@ 66-84 (lines=19) @@ | ||
| 63 | } |
|
| 64 | ||
| 65 | /** @test */ |
|
| 66 | public function it_encrypts_passwords_automatically() |
|
| 67 | { |
|
| 68 | $model = $this->model(['foo'=>'']); |
|
| 69 | ||
| 70 | $request = $this->request(); |
|
| 71 | $request->method('all')->will($this->returnValue(['foo'=>'bar', 'baz'=>true])); |
|
| 72 | $request->method('get')->will($this->returnValueMap([ |
|
| 73 | ['foo', 'bar'], |
|
| 74 | ['baz', true], |
|
| 75 | ])); |
|
| 76 | ||
| 77 | $form = $this->form($request); |
|
| 78 | $form->password('foo'); |
|
| 79 | $form->button('baz'); |
|
| 80 | ||
| 81 | $form->fill($model); |
|
| 82 | ||
| 83 | $this->assertNotSame($model->foo, 'bar'); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** @test */ |
|
| 87 | public function it_can_check_if_password_matches() |
|