| @@ 138-146 (lines=9) @@ | ||
| 135 | } |
|
| 136 | ||
| 137 | /** @test */ |
|
| 138 | public function it_validates_in() |
|
| 139 | { |
|
| 140 | $this->assertValid(function($form) { $form->number('foo')->in(); }); |
|
| 141 | $this->assertValid(function($form) { $form->number('foo')->in([1, 2, 3]); }); |
|
| 142 | $this->assertValid(function($form) { $form->number('foo')->in([1, 2, 3])->default(1); }); |
|
| 143 | ||
| 144 | $this->assertNotValid(function($form) { $form->number('foo')->in([1, 2, 3])->required(); }); |
|
| 145 | $this->assertNotValid(function($form) { $form->number('foo')->in([1, 2, 3])->default(4); }); |
|
| 146 | } |
|
| 147 | ||
| 148 | /** @test */ |
|
| 149 | public function it_validates_not_in() |
|
| @@ 149-157 (lines=9) @@ | ||
| 146 | } |
|
| 147 | ||
| 148 | /** @test */ |
|
| 149 | public function it_validates_not_in() |
|
| 150 | { |
|
| 151 | $this->assertValid(function($form) { $form->number('foo')->not_in(); }); |
|
| 152 | $this->assertValid(function($form) { $form->number('foo')->not_in([1, 2, 3]); }); |
|
| 153 | $this->assertValid(function($form) { $form->number('foo')->not_in([1, 2, 3])->default(4); }); |
|
| 154 | ||
| 155 | $this->assertNotValid(function($form) { $form->number('foo')->not_in([1, 2, 3])->required(); }); |
|
| 156 | $this->assertNotValid(function($form) { $form->number('foo')->not_in([1, 2, 3])->default(1); }); |
|
| 157 | } |
|
| 158 | ||
| 159 | } |
|
| 160 | ||
| @@ 151-159 (lines=9) @@ | ||
| 148 | } |
|
| 149 | ||
| 150 | /** @test */ |
|
| 151 | public function it_validates_in() |
|
| 152 | { |
|
| 153 | $this->assertValid(function($form) { $form->text('foo')->in(); }); |
|
| 154 | $this->assertValid(function($form) { $form->text('foo')->in(['a', 'b','c']); }); |
|
| 155 | $this->assertValid(function($form) { $form->text('foo')->in(['a', 'b','c'])->default('a'); }); |
|
| 156 | ||
| 157 | $this->assertNotValid(function($form) { $form->text('foo')->in(['a', 'b','c'])->required(); }); |
|
| 158 | $this->assertNotValid(function($form) { $form->text('foo')->in(['a', 'b','c'])->default('d'); }); |
|
| 159 | } |
|
| 160 | ||
| 161 | /** @test */ |
|
| 162 | public function it_validates_not_in() |
|
| @@ 162-170 (lines=9) @@ | ||
| 159 | } |
|
| 160 | ||
| 161 | /** @test */ |
|
| 162 | public function it_validates_not_in() |
|
| 163 | { |
|
| 164 | $this->assertValid(function($form) { $form->text('foo')->not_in(); }); |
|
| 165 | $this->assertValid(function($form) { $form->text('foo')->not_in(['a', 'b','c']); }); |
|
| 166 | $this->assertValid(function($form) { $form->text('foo')->not_in(['a', 'b','c'])->default('d'); }); |
|
| 167 | ||
| 168 | $this->assertNotValid(function($form) { $form->text('foo')->not_in(['a', 'b','c'])->required(); }); |
|
| 169 | $this->assertNotValid(function($form) { $form->text('foo')->not_in(['a', 'b','c'])->default('a'); }); |
|
| 170 | } |
|
| 171 | ||
| 172 | } |
|
| 173 | ||