@@ -25,12 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | public function setValuesFromDefaults($defaults) |
27 | 27 | { |
28 | - if (count($defaults)) $this->value = array_shift($defaults); |
|
28 | + if (count($defaults)) { |
|
29 | + $this->value = array_shift($defaults); |
|
30 | + } |
|
29 | 31 | } |
30 | 32 | |
31 | 33 | public function setValuesFromModel($model) |
32 | 34 | { |
33 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
35 | + if (property_exists($model, $this->name)) { |
|
36 | + $this->value = $model->{$this->name}; |
|
37 | + } |
|
34 | 38 | } |
35 | 39 | |
36 | 40 | public function setValuesFromRequest($request) |
@@ -40,7 +44,9 @@ discard block |
||
40 | 44 | |
41 | 45 | public function fillModelWithValues($model) |
42 | 46 | { |
43 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
47 | + if (property_exists($model, $this->name)) { |
|
48 | + $model->{$this->name} = $this->value; |
|
49 | + } |
|
44 | 50 | } |
45 | 51 | |
46 | 52 | public function validateRequired() |
@@ -4,76 +4,76 @@ |
||
4 | 4 | |
5 | 5 | class DropdownTest extends FormTestCase { |
6 | 6 | |
7 | - /** @test */ |
|
8 | - public function it_can_be_rendered() |
|
9 | - { |
|
10 | - $form = $this->form(); |
|
11 | - $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
12 | - $this->assertContains('<select name="foo"', $form->render()); |
|
13 | - $this->assertContains('<option value="a">A</option>', $form->render()); |
|
14 | - $this->assertContains('<option value="b">B</option>', $form->render()); |
|
15 | - $this->assertContains('<option value="c">C</option>', $form->render()); |
|
16 | - } |
|
17 | - |
|
18 | - /** @test */ |
|
19 | - public function it_renders_a_default_value() |
|
20 | - { |
|
21 | - $form = $this->form(); |
|
22 | - $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->default('b'); |
|
23 | - |
|
24 | - $this->assertContains('<option value="a">A</option>', $form->render()); |
|
25 | - $this->assertContains('<option value="b" selected="selected">B</option>', $form->render()); |
|
26 | - $this->assertContains('<option value="c">C</option>', $form->render()); |
|
27 | - } |
|
28 | - |
|
29 | - /** @test */ |
|
30 | - public function it_renders_model_values() |
|
31 | - { |
|
32 | - $form = $this->form(); |
|
33 | - $form->defaults($this->model(['foo'=>'b'])); |
|
34 | - $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
35 | - |
|
36 | - $this->assertContains('<option value="a">A</option>', $form->render()); |
|
37 | - $this->assertContains('<option value="b" selected="selected">B</option>', $form->render()); |
|
38 | - $this->assertContains('<option value="c">C</option>', $form->render()); |
|
39 | - } |
|
40 | - |
|
41 | - /** @test */ |
|
42 | - public function it_can_fill_model_values() |
|
43 | - { |
|
44 | - $model = $this->model(['foo'=>'']); |
|
45 | - |
|
46 | - $form = $this->form(); |
|
47 | - $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->default('b'); |
|
48 | - $form->fill($model); |
|
49 | - |
|
50 | - $form->assertEquals($model->foo, 'b'); |
|
51 | - } |
|
52 | - |
|
53 | - /** @test */ |
|
54 | - public function it_provides_expected_values() |
|
55 | - { |
|
56 | - $form = $this->form(); |
|
57 | - $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
58 | - |
|
59 | - $this->assertSame($form->get('foo'), ''); |
|
60 | - } |
|
61 | - |
|
62 | - /** @test */ |
|
63 | - public function it_provides_expected_default_values() |
|
64 | - { |
|
65 | - $form = $this->form(); |
|
66 | - $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->default('c'); |
|
67 | - |
|
68 | - $this->assertSame($form->get('foo'), 'c'); |
|
69 | - } |
|
70 | - |
|
71 | - /** @test */ |
|
7 | + /** @test */ |
|
8 | + public function it_can_be_rendered() |
|
9 | + { |
|
10 | + $form = $this->form(); |
|
11 | + $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
12 | + $this->assertContains('<select name="foo"', $form->render()); |
|
13 | + $this->assertContains('<option value="a">A</option>', $form->render()); |
|
14 | + $this->assertContains('<option value="b">B</option>', $form->render()); |
|
15 | + $this->assertContains('<option value="c">C</option>', $form->render()); |
|
16 | + } |
|
17 | + |
|
18 | + /** @test */ |
|
19 | + public function it_renders_a_default_value() |
|
20 | + { |
|
21 | + $form = $this->form(); |
|
22 | + $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->default('b'); |
|
23 | + |
|
24 | + $this->assertContains('<option value="a">A</option>', $form->render()); |
|
25 | + $this->assertContains('<option value="b" selected="selected">B</option>', $form->render()); |
|
26 | + $this->assertContains('<option value="c">C</option>', $form->render()); |
|
27 | + } |
|
28 | + |
|
29 | + /** @test */ |
|
30 | + public function it_renders_model_values() |
|
31 | + { |
|
32 | + $form = $this->form(); |
|
33 | + $form->defaults($this->model(['foo'=>'b'])); |
|
34 | + $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
35 | + |
|
36 | + $this->assertContains('<option value="a">A</option>', $form->render()); |
|
37 | + $this->assertContains('<option value="b" selected="selected">B</option>', $form->render()); |
|
38 | + $this->assertContains('<option value="c">C</option>', $form->render()); |
|
39 | + } |
|
40 | + |
|
41 | + /** @test */ |
|
42 | + public function it_can_fill_model_values() |
|
43 | + { |
|
44 | + $model = $this->model(['foo'=>'']); |
|
45 | + |
|
46 | + $form = $this->form(); |
|
47 | + $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->default('b'); |
|
48 | + $form->fill($model); |
|
49 | + |
|
50 | + $form->assertEquals($model->foo, 'b'); |
|
51 | + } |
|
52 | + |
|
53 | + /** @test */ |
|
54 | + public function it_provides_expected_values() |
|
55 | + { |
|
56 | + $form = $this->form(); |
|
57 | + $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
58 | + |
|
59 | + $this->assertSame($form->get('foo'), ''); |
|
60 | + } |
|
61 | + |
|
62 | + /** @test */ |
|
63 | + public function it_provides_expected_default_values() |
|
64 | + { |
|
65 | + $form = $this->form(); |
|
66 | + $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->default('c'); |
|
67 | + |
|
68 | + $this->assertSame($form->get('foo'), 'c'); |
|
69 | + } |
|
70 | + |
|
71 | + /** @test */ |
|
72 | 72 | public function it_validates_required() |
73 | 73 | { |
74 | - $this->assertValid(function($form) { $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); }); |
|
74 | + $this->assertValid(function($form) { $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); }); |
|
75 | 75 | |
76 | - $this->assertNotValid(function($form) { $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->required(); }); |
|
77 | - } |
|
76 | + $this->assertNotValid(function($form) { $form->dropdown('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->required(); }); |
|
77 | + } |
|
78 | 78 | |
79 | 79 | } |
@@ -4,78 +4,78 @@ |
||
4 | 4 | |
5 | 5 | class ParagraphTextTest extends FormTestCase { |
6 | 6 | |
7 | - /** @test */ |
|
8 | - public function it_can_be_rendered() |
|
9 | - { |
|
10 | - $form = $this->form(); |
|
11 | - $form->paragraph_text('foo'); |
|
12 | - $this->assertContains('<textarea name="foo"', $form->render()); |
|
13 | - } |
|
14 | - |
|
15 | - /** @test */ |
|
16 | - public function it_renders_a_default_value() |
|
17 | - { |
|
18 | - $form = $this->form(); |
|
19 | - $form->paragraph_text('foo')->default('bar'); |
|
20 | - $this->assertContains('<textarea name="foo"', $form->render()); |
|
21 | - $this->assertContains('bar</textarea>', $form->render()); |
|
22 | - } |
|
23 | - |
|
24 | - /** @test */ |
|
25 | - public function it_renders_model_values() |
|
26 | - { |
|
27 | - $form = $this->form(); |
|
28 | - $form->defaults($this->model(['foo'=>'bar'])); |
|
29 | - $form->paragraph_text('foo'); |
|
30 | - $this->assertContains('<textarea name="foo"', $form->render()); |
|
31 | - $this->assertContains('bar</textarea>', $form->render()); |
|
32 | - } |
|
33 | - |
|
34 | - /** @test */ |
|
35 | - public function it_can_fill_model_values() |
|
36 | - { |
|
37 | - $model = $this->model(['foo'=>'']); |
|
38 | - |
|
39 | - $form = $this->form(); |
|
40 | - $form->paragraph_text('foo')->default('bar'); |
|
41 | - $form->fill($model); |
|
42 | - |
|
43 | - $form->assertEquals($model->foo, 'bar'); |
|
44 | - } |
|
45 | - |
|
46 | - /** @test */ |
|
47 | - public function it_escapes_value() |
|
48 | - { |
|
49 | - $form = $this->form(); |
|
50 | - $form->paragraph_text('foo')->default('bar&'); |
|
51 | - $this->assertContains('<textarea name="foo"', $form->render()); |
|
52 | - $this->assertContains('bar&</textarea>', $form->render()); |
|
53 | - } |
|
54 | - |
|
55 | - /** @test */ |
|
56 | - public function it_provides_expected_values() |
|
57 | - { |
|
58 | - $form = $this->form(); |
|
59 | - $form->paragraph_text('foo'); |
|
60 | - |
|
61 | - $this->assertSame($form->get('foo'), ''); |
|
62 | - } |
|
63 | - |
|
64 | - /** @test */ |
|
65 | - public function it_provides_expected_default_values() |
|
66 | - { |
|
67 | - $form = $this->form(); |
|
68 | - $form->paragraph_text('foo')->default('bar'); |
|
69 | - |
|
70 | - $this->assertSame($form->get('foo'), 'bar'); |
|
71 | - } |
|
72 | - |
|
73 | - /** @test */ |
|
7 | + /** @test */ |
|
8 | + public function it_can_be_rendered() |
|
9 | + { |
|
10 | + $form = $this->form(); |
|
11 | + $form->paragraph_text('foo'); |
|
12 | + $this->assertContains('<textarea name="foo"', $form->render()); |
|
13 | + } |
|
14 | + |
|
15 | + /** @test */ |
|
16 | + public function it_renders_a_default_value() |
|
17 | + { |
|
18 | + $form = $this->form(); |
|
19 | + $form->paragraph_text('foo')->default('bar'); |
|
20 | + $this->assertContains('<textarea name="foo"', $form->render()); |
|
21 | + $this->assertContains('bar</textarea>', $form->render()); |
|
22 | + } |
|
23 | + |
|
24 | + /** @test */ |
|
25 | + public function it_renders_model_values() |
|
26 | + { |
|
27 | + $form = $this->form(); |
|
28 | + $form->defaults($this->model(['foo'=>'bar'])); |
|
29 | + $form->paragraph_text('foo'); |
|
30 | + $this->assertContains('<textarea name="foo"', $form->render()); |
|
31 | + $this->assertContains('bar</textarea>', $form->render()); |
|
32 | + } |
|
33 | + |
|
34 | + /** @test */ |
|
35 | + public function it_can_fill_model_values() |
|
36 | + { |
|
37 | + $model = $this->model(['foo'=>'']); |
|
38 | + |
|
39 | + $form = $this->form(); |
|
40 | + $form->paragraph_text('foo')->default('bar'); |
|
41 | + $form->fill($model); |
|
42 | + |
|
43 | + $form->assertEquals($model->foo, 'bar'); |
|
44 | + } |
|
45 | + |
|
46 | + /** @test */ |
|
47 | + public function it_escapes_value() |
|
48 | + { |
|
49 | + $form = $this->form(); |
|
50 | + $form->paragraph_text('foo')->default('bar&'); |
|
51 | + $this->assertContains('<textarea name="foo"', $form->render()); |
|
52 | + $this->assertContains('bar&</textarea>', $form->render()); |
|
53 | + } |
|
54 | + |
|
55 | + /** @test */ |
|
56 | + public function it_provides_expected_values() |
|
57 | + { |
|
58 | + $form = $this->form(); |
|
59 | + $form->paragraph_text('foo'); |
|
60 | + |
|
61 | + $this->assertSame($form->get('foo'), ''); |
|
62 | + } |
|
63 | + |
|
64 | + /** @test */ |
|
65 | + public function it_provides_expected_default_values() |
|
66 | + { |
|
67 | + $form = $this->form(); |
|
68 | + $form->paragraph_text('foo')->default('bar'); |
|
69 | + |
|
70 | + $this->assertSame($form->get('foo'), 'bar'); |
|
71 | + } |
|
72 | + |
|
73 | + /** @test */ |
|
74 | 74 | public function it_validates_required() |
75 | 75 | { |
76 | - $this->assertValid(function($form) { $form->paragraph_text('foo'); }); |
|
76 | + $this->assertValid(function($form) { $form->paragraph_text('foo'); }); |
|
77 | 77 | |
78 | - $this->assertNotValid(function($form) { $form->paragraph_text('foo')->required(); }); |
|
79 | - } |
|
78 | + $this->assertNotValid(function($form) { $form->paragraph_text('foo')->required(); }); |
|
79 | + } |
|
80 | 80 | |
81 | 81 | } |
@@ -4,85 +4,85 @@ |
||
4 | 4 | |
5 | 5 | class NameTest extends FormTestCase { |
6 | 6 | |
7 | - /** @test */ |
|
8 | - public function it_can_be_rendered() |
|
9 | - { |
|
10 | - $form = $this->form(); |
|
11 | - $form->name('foo'); |
|
12 | - $this->assertContains('<input name="foo_first" value=""', $form->render()); |
|
13 | - $this->assertContains('<input name="foo_surname" value=""', $form->render()); |
|
14 | - } |
|
15 | - |
|
16 | - /** @test */ |
|
17 | - public function it_renders_default_values() |
|
18 | - { |
|
19 | - $form = $this->form(); |
|
20 | - $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz']); |
|
21 | - $this->assertContains('<input name="foo_first" value="bar"', $form->render()); |
|
22 | - $this->assertContains('<input name="foo_surname" value="baz"', $form->render()); |
|
23 | - } |
|
24 | - |
|
25 | - /** @test */ |
|
26 | - public function it_renders_model_values() |
|
27 | - { |
|
28 | - $form = $this->form(); |
|
29 | - $form->defaults($this->model(['foo'=>'bar baz', 'foo_first'=>'bar', 'foo_surname'=>'baz'])); |
|
30 | - $form->name('foo'); |
|
31 | - $this->assertContains('<input name="foo_first" value="bar"', $form->render()); |
|
32 | - $this->assertContains('<input name="foo_surname" value="baz"', $form->render()); |
|
33 | - } |
|
34 | - |
|
35 | - /** @test */ |
|
36 | - public function it_can_fill_model_values() |
|
37 | - { |
|
38 | - $model = $this->model(['foo'=>'', 'foo_first'=>'', 'foo_surname'=>'']); |
|
39 | - |
|
40 | - $form = $this->form(); |
|
41 | - $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz']); |
|
42 | - $form->fill($model); |
|
43 | - |
|
44 | - $form->assertEquals($model->foo, 'bar baz'); |
|
45 | - $form->assertEquals($model->foo_first, 'bar'); |
|
46 | - $form->assertEquals($model->foo_surname, 'baz'); |
|
47 | - } |
|
48 | - |
|
49 | - /** @test */ |
|
50 | - public function it_escapes_values() |
|
51 | - { |
|
52 | - $form = $this->form(); |
|
53 | - $form->name('foo')->default(['first'=>'bar&', 'surname'=>'baz&']); |
|
54 | - $this->assertContains('<input name="foo_first" value="bar&"', $form->render()); |
|
55 | - $this->assertContains('<input name="foo_surname" value="baz&"', $form->render()); |
|
56 | - } |
|
57 | - |
|
58 | - /** @test */ |
|
59 | - public function it_provides_expected_values() |
|
60 | - { |
|
61 | - $form = $this->form(); |
|
62 | - $form->name('foo'); |
|
63 | - |
|
64 | - $expected = ['foo_first'=>'', 'foo_surname'=>'', 'foo'=>'']; |
|
65 | - $this->assertSame($form->get('foo'), $expected); |
|
66 | - } |
|
67 | - |
|
68 | - /** @test */ |
|
69 | - public function it_provides_expected_default_values() |
|
70 | - { |
|
71 | - $form = $this->form(); |
|
72 | - $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz']); |
|
73 | - |
|
74 | - $expected = ['foo_first'=>'bar', 'foo_surname'=>'baz', 'foo'=>'bar baz']; |
|
75 | - $this->assertSame($form->get('foo'), $expected); |
|
76 | - } |
|
77 | - |
|
78 | - /** @test */ |
|
7 | + /** @test */ |
|
8 | + public function it_can_be_rendered() |
|
9 | + { |
|
10 | + $form = $this->form(); |
|
11 | + $form->name('foo'); |
|
12 | + $this->assertContains('<input name="foo_first" value=""', $form->render()); |
|
13 | + $this->assertContains('<input name="foo_surname" value=""', $form->render()); |
|
14 | + } |
|
15 | + |
|
16 | + /** @test */ |
|
17 | + public function it_renders_default_values() |
|
18 | + { |
|
19 | + $form = $this->form(); |
|
20 | + $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz']); |
|
21 | + $this->assertContains('<input name="foo_first" value="bar"', $form->render()); |
|
22 | + $this->assertContains('<input name="foo_surname" value="baz"', $form->render()); |
|
23 | + } |
|
24 | + |
|
25 | + /** @test */ |
|
26 | + public function it_renders_model_values() |
|
27 | + { |
|
28 | + $form = $this->form(); |
|
29 | + $form->defaults($this->model(['foo'=>'bar baz', 'foo_first'=>'bar', 'foo_surname'=>'baz'])); |
|
30 | + $form->name('foo'); |
|
31 | + $this->assertContains('<input name="foo_first" value="bar"', $form->render()); |
|
32 | + $this->assertContains('<input name="foo_surname" value="baz"', $form->render()); |
|
33 | + } |
|
34 | + |
|
35 | + /** @test */ |
|
36 | + public function it_can_fill_model_values() |
|
37 | + { |
|
38 | + $model = $this->model(['foo'=>'', 'foo_first'=>'', 'foo_surname'=>'']); |
|
39 | + |
|
40 | + $form = $this->form(); |
|
41 | + $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz']); |
|
42 | + $form->fill($model); |
|
43 | + |
|
44 | + $form->assertEquals($model->foo, 'bar baz'); |
|
45 | + $form->assertEquals($model->foo_first, 'bar'); |
|
46 | + $form->assertEquals($model->foo_surname, 'baz'); |
|
47 | + } |
|
48 | + |
|
49 | + /** @test */ |
|
50 | + public function it_escapes_values() |
|
51 | + { |
|
52 | + $form = $this->form(); |
|
53 | + $form->name('foo')->default(['first'=>'bar&', 'surname'=>'baz&']); |
|
54 | + $this->assertContains('<input name="foo_first" value="bar&"', $form->render()); |
|
55 | + $this->assertContains('<input name="foo_surname" value="baz&"', $form->render()); |
|
56 | + } |
|
57 | + |
|
58 | + /** @test */ |
|
59 | + public function it_provides_expected_values() |
|
60 | + { |
|
61 | + $form = $this->form(); |
|
62 | + $form->name('foo'); |
|
63 | + |
|
64 | + $expected = ['foo_first'=>'', 'foo_surname'=>'', 'foo'=>'']; |
|
65 | + $this->assertSame($form->get('foo'), $expected); |
|
66 | + } |
|
67 | + |
|
68 | + /** @test */ |
|
69 | + public function it_provides_expected_default_values() |
|
70 | + { |
|
71 | + $form = $this->form(); |
|
72 | + $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz']); |
|
73 | + |
|
74 | + $expected = ['foo_first'=>'bar', 'foo_surname'=>'baz', 'foo'=>'bar baz']; |
|
75 | + $this->assertSame($form->get('foo'), $expected); |
|
76 | + } |
|
77 | + |
|
78 | + /** @test */ |
|
79 | 79 | public function it_validates_required() |
80 | 80 | { |
81 | - $this->assertValid(function($form) { $form->name('foo'); }); |
|
82 | - $this->assertValid(function($form) { $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz'])->required(); }); |
|
81 | + $this->assertValid(function($form) { $form->name('foo'); }); |
|
82 | + $this->assertValid(function($form) { $form->name('foo')->default(['first'=>'bar', 'surname'=>'baz'])->required(); }); |
|
83 | 83 | |
84 | - $this->assertNotValid(function($form) { $form->name('foo')->required(); }); |
|
85 | - $this->assertNotValid(function($form) { $form->name('foo')->default(['first'=>'bar'])->required(); }); |
|
86 | - } |
|
84 | + $this->assertNotValid(function($form) { $form->name('foo')->required(); }); |
|
85 | + $this->assertNotValid(function($form) { $form->name('foo')->default(['first'=>'bar'])->required(); }); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | } |
@@ -4,120 +4,120 @@ |
||
4 | 4 | |
5 | 5 | class CheckboxesTest extends FormTestCase { |
6 | 6 | |
7 | - /** @test */ |
|
8 | - public function it_can_be_rendered() |
|
9 | - { |
|
10 | - $form = $this->form(); |
|
11 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
12 | - $this->assertContains('<input name="foo_a" type="checkbox"', $form->render()); |
|
13 | - $this->assertContains('<input name="foo_b" type="checkbox"', $form->render()); |
|
14 | - $this->assertContains('<input name="foo_c" type="checkbox"', $form->render()); |
|
15 | - } |
|
16 | - |
|
17 | - /** @test */ |
|
18 | - public function it_is_unchecked_by_default() |
|
19 | - { |
|
20 | - $form = $this->form(); |
|
21 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
22 | - $this->assertNotContains('checked="checked"', $form->render()); |
|
23 | - } |
|
24 | - |
|
25 | - /** @test */ |
|
26 | - public function it_can_be_checked() |
|
27 | - { |
|
28 | - $form = $this->form(); |
|
29 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(); |
|
30 | - |
|
31 | - $this->assertContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
32 | - $this->assertContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
33 | - $this->assertContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
34 | - } |
|
35 | - |
|
36 | - /** @test */ |
|
37 | - public function it_can_be_unchecked() |
|
38 | - { |
|
39 | - $form = $this->form(); |
|
40 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->unchecked(); |
|
41 | - |
|
42 | - $this->assertNotContains('checked="checked"', $form->render()); |
|
43 | - } |
|
44 | - |
|
45 | - /** @test */ |
|
46 | - public function it_can_check_specific_options() |
|
47 | - { |
|
48 | - $form = $this->form(); |
|
49 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(['a', 'c']); |
|
50 | - |
|
51 | - $this->assertContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
52 | - $this->assertNotContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
53 | - $this->assertContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
54 | - } |
|
55 | - |
|
56 | - /** @test */ |
|
57 | - public function it_can_uncheck_specific_options() |
|
58 | - { |
|
59 | - $form = $this->form(); |
|
60 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->unchecked(['a', 'c']); |
|
61 | - |
|
62 | - $this->assertNotContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
63 | - $this->assertContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
64 | - $this->assertNotContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
65 | - } |
|
66 | - |
|
67 | - /** @test */ |
|
68 | - public function it_renders_model_values() |
|
69 | - { |
|
70 | - $form = $this->form(); |
|
71 | - $form->defaults($this->model(['foo_a'=>0, 'foo_b'=>1, 'foo_c'=>0])); |
|
72 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
73 | - |
|
74 | - $this->assertNotContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
75 | - $this->assertContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
76 | - $this->assertNotContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
77 | - } |
|
78 | - |
|
79 | - /** @test */ |
|
80 | - public function it_can_fill_model_values() |
|
81 | - { |
|
82 | - $model = $this->model(['foo_a'=>0, 'foo_b'=>0, 'foo_c'=>0]); |
|
83 | - |
|
84 | - $form = $this->form(); |
|
85 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(['a', 'c']); |
|
86 | - $form->fill($model); |
|
87 | - |
|
88 | - $form->assertEquals($model->foo_a, 1); |
|
89 | - $form->assertEquals($model->foo_b, 0); |
|
90 | - $form->assertEquals($model->foo_c, 1); |
|
91 | - } |
|
92 | - |
|
93 | - /** @test */ |
|
94 | - public function it_provides_expected_values() |
|
95 | - { |
|
96 | - $form = $this->form(); |
|
97 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
98 | - |
|
99 | - $expected = ['foo_a'=>false, 'foo_b'=>false, 'foo_c'=>false]; |
|
100 | - $this->assertSame($form->get('foo'), $expected); |
|
101 | - } |
|
102 | - |
|
103 | - /** @test */ |
|
104 | - public function it_provides_expected_default_values() |
|
105 | - { |
|
106 | - $form = $this->form(); |
|
107 | - $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(['a', 'c']); |
|
108 | - |
|
109 | - $expected = ['foo_a'=>true, 'foo_b'=>false, 'foo_c'=>true]; |
|
110 | - $this->assertSame($form->get('foo'), $expected); |
|
111 | - } |
|
112 | - |
|
113 | - /** @test */ |
|
7 | + /** @test */ |
|
8 | + public function it_can_be_rendered() |
|
9 | + { |
|
10 | + $form = $this->form(); |
|
11 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
12 | + $this->assertContains('<input name="foo_a" type="checkbox"', $form->render()); |
|
13 | + $this->assertContains('<input name="foo_b" type="checkbox"', $form->render()); |
|
14 | + $this->assertContains('<input name="foo_c" type="checkbox"', $form->render()); |
|
15 | + } |
|
16 | + |
|
17 | + /** @test */ |
|
18 | + public function it_is_unchecked_by_default() |
|
19 | + { |
|
20 | + $form = $this->form(); |
|
21 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
22 | + $this->assertNotContains('checked="checked"', $form->render()); |
|
23 | + } |
|
24 | + |
|
25 | + /** @test */ |
|
26 | + public function it_can_be_checked() |
|
27 | + { |
|
28 | + $form = $this->form(); |
|
29 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(); |
|
30 | + |
|
31 | + $this->assertContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
32 | + $this->assertContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
33 | + $this->assertContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
34 | + } |
|
35 | + |
|
36 | + /** @test */ |
|
37 | + public function it_can_be_unchecked() |
|
38 | + { |
|
39 | + $form = $this->form(); |
|
40 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->unchecked(); |
|
41 | + |
|
42 | + $this->assertNotContains('checked="checked"', $form->render()); |
|
43 | + } |
|
44 | + |
|
45 | + /** @test */ |
|
46 | + public function it_can_check_specific_options() |
|
47 | + { |
|
48 | + $form = $this->form(); |
|
49 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(['a', 'c']); |
|
50 | + |
|
51 | + $this->assertContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
52 | + $this->assertNotContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
53 | + $this->assertContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
54 | + } |
|
55 | + |
|
56 | + /** @test */ |
|
57 | + public function it_can_uncheck_specific_options() |
|
58 | + { |
|
59 | + $form = $this->form(); |
|
60 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->unchecked(['a', 'c']); |
|
61 | + |
|
62 | + $this->assertNotContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
63 | + $this->assertContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
64 | + $this->assertNotContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
65 | + } |
|
66 | + |
|
67 | + /** @test */ |
|
68 | + public function it_renders_model_values() |
|
69 | + { |
|
70 | + $form = $this->form(); |
|
71 | + $form->defaults($this->model(['foo_a'=>0, 'foo_b'=>1, 'foo_c'=>0])); |
|
72 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
73 | + |
|
74 | + $this->assertNotContains('<input name="foo_a" type="checkbox" checked="checked"', $form->render()); |
|
75 | + $this->assertContains('<input name="foo_b" type="checkbox" checked="checked"', $form->render()); |
|
76 | + $this->assertNotContains('<input name="foo_c" type="checkbox" checked="checked"', $form->render()); |
|
77 | + } |
|
78 | + |
|
79 | + /** @test */ |
|
80 | + public function it_can_fill_model_values() |
|
81 | + { |
|
82 | + $model = $this->model(['foo_a'=>0, 'foo_b'=>0, 'foo_c'=>0]); |
|
83 | + |
|
84 | + $form = $this->form(); |
|
85 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(['a', 'c']); |
|
86 | + $form->fill($model); |
|
87 | + |
|
88 | + $form->assertEquals($model->foo_a, 1); |
|
89 | + $form->assertEquals($model->foo_b, 0); |
|
90 | + $form->assertEquals($model->foo_c, 1); |
|
91 | + } |
|
92 | + |
|
93 | + /** @test */ |
|
94 | + public function it_provides_expected_values() |
|
95 | + { |
|
96 | + $form = $this->form(); |
|
97 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); |
|
98 | + |
|
99 | + $expected = ['foo_a'=>false, 'foo_b'=>false, 'foo_c'=>false]; |
|
100 | + $this->assertSame($form->get('foo'), $expected); |
|
101 | + } |
|
102 | + |
|
103 | + /** @test */ |
|
104 | + public function it_provides_expected_default_values() |
|
105 | + { |
|
106 | + $form = $this->form(); |
|
107 | + $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(['a', 'c']); |
|
108 | + |
|
109 | + $expected = ['foo_a'=>true, 'foo_b'=>false, 'foo_c'=>true]; |
|
110 | + $this->assertSame($form->get('foo'), $expected); |
|
111 | + } |
|
112 | + |
|
113 | + /** @test */ |
|
114 | 114 | public function it_validates_required() |
115 | 115 | { |
116 | - $this->assertValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); }); |
|
117 | - $this->assertValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->required(); }); |
|
116 | + $this->assertValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C']); }); |
|
117 | + $this->assertValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->required(); }); |
|
118 | 118 | |
119 | - $this->assertNotValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->required(); }); |
|
120 | - $this->assertNotValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->unchecked()->required(); }); |
|
121 | - } |
|
119 | + $this->assertNotValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->required(); }); |
|
120 | + $this->assertNotValid(function($form) { $form->checkboxes('foo')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked()->unchecked()->required(); }); |
|
121 | + } |
|
122 | 122 | |
123 | 123 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class FormWithDefinition extends \Helmut\Forms\Form { |
6 | 6 | |
7 | - public function define() |
|
8 | - { |
|
9 | - $this->text('foo'); |
|
10 | - } |
|
7 | + public function define() |
|
8 | + { |
|
9 | + $this->text('foo'); |
|
10 | + } |
|
11 | 11 | |
12 | 12 | } |
@@ -6,52 +6,52 @@ |
||
6 | 6 | |
7 | 7 | class FormTestCase extends \PHPUnit_Framework_TestCase{ |
8 | 8 | |
9 | - public function request() |
|
10 | - { |
|
11 | - $request = $this->getMock('Helmut\Forms\Request'); |
|
12 | - $request->method('csrf')->will($this->returnValue([])); |
|
13 | - return $request; |
|
14 | - } |
|
15 | - |
|
16 | - public function form($request=null) |
|
17 | - { |
|
18 | - if ( ! $request) $request = $this->request(); |
|
19 | - |
|
20 | - $form = new Stubs\Form($request); |
|
21 | - $form->removeAllPlugins(); |
|
22 | - return $form; |
|
23 | - } |
|
24 | - |
|
25 | - public function model($properties = []) |
|
26 | - { |
|
27 | - $model = new \stdClass; |
|
28 | - foreach ($properties as $key => $value) { |
|
29 | - $model->$key = $value; |
|
30 | - } |
|
31 | - return $model; |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - public function assertValid($callback) |
|
36 | - { |
|
37 | - $form = $this->form(); |
|
38 | - call_user_func($callback, $form); |
|
39 | - return $this->assertTrue($form->valid()); |
|
40 | - } |
|
41 | - |
|
42 | - public function assertNotValid($callback) |
|
43 | - { |
|
44 | - $form = $this->form(); |
|
45 | - call_user_func($callback, $form); |
|
46 | - return $this->assertFalse($form->valid()); |
|
47 | - } |
|
48 | - |
|
49 | - public function tearDown() |
|
9 | + public function request() |
|
10 | + { |
|
11 | + $request = $this->getMock('Helmut\Forms\Request'); |
|
12 | + $request->method('csrf')->will($this->returnValue([])); |
|
13 | + return $request; |
|
14 | + } |
|
15 | + |
|
16 | + public function form($request=null) |
|
17 | + { |
|
18 | + if ( ! $request) $request = $this->request(); |
|
19 | + |
|
20 | + $form = new Stubs\Form($request); |
|
21 | + $form->removeAllPlugins(); |
|
22 | + return $form; |
|
23 | + } |
|
24 | + |
|
25 | + public function model($properties = []) |
|
26 | + { |
|
27 | + $model = new \stdClass; |
|
28 | + foreach ($properties as $key => $value) { |
|
29 | + $model->$key = $value; |
|
30 | + } |
|
31 | + return $model; |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + public function assertValid($callback) |
|
36 | + { |
|
37 | + $form = $this->form(); |
|
38 | + call_user_func($callback, $form); |
|
39 | + return $this->assertTrue($form->valid()); |
|
40 | + } |
|
41 | + |
|
42 | + public function assertNotValid($callback) |
|
43 | + { |
|
44 | + $form = $this->form(); |
|
45 | + call_user_func($callback, $form); |
|
46 | + return $this->assertFalse($form->valid()); |
|
47 | + } |
|
48 | + |
|
49 | + public function tearDown() |
|
50 | 50 | { |
51 | 51 | if (class_exists('Mockery')) |
52 | 52 | { |
53 | 53 | \Mockery::close(); |
54 | 54 | } |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | //use Helmut\Forms\Testing\Stubs\Form; |
6 | 6 | |
7 | -class FormTestCase extends \PHPUnit_Framework_TestCase{ |
|
7 | +class FormTestCase extends \PHPUnit_Framework_TestCase { |
|
8 | 8 | |
9 | 9 | public function request() |
10 | 10 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | return $request; |
14 | 14 | } |
15 | 15 | |
16 | - public function form($request=null) |
|
16 | + public function form($request = null) |
|
17 | 17 | { |
18 | 18 | if ( ! $request) $request = $this->request(); |
19 | 19 |
@@ -15,7 +15,9 @@ |
||
15 | 15 | |
16 | 16 | public function form($request=null) |
17 | 17 | { |
18 | - if ( ! $request) $request = $this->request(); |
|
18 | + if ( ! $request) { |
|
19 | + $request = $this->request(); |
|
20 | + } |
|
19 | 21 | |
20 | 22 | $form = new Stubs\Form($request); |
21 | 23 | $form->removeAllPlugins(); |
@@ -4,24 +4,24 @@ |
||
4 | 4 | |
5 | 5 | class ButtonTest extends FormTestCase { |
6 | 6 | |
7 | - /** @test */ |
|
8 | - public function it_can_be_rendered() |
|
9 | - { |
|
10 | - $form = $this->form(); |
|
11 | - $form->button('register'); |
|
12 | - $this->assertContains('<button name="register"', $form->render()); |
|
13 | - } |
|
7 | + /** @test */ |
|
8 | + public function it_can_be_rendered() |
|
9 | + { |
|
10 | + $form = $this->form(); |
|
11 | + $form->button('register'); |
|
12 | + $this->assertContains('<button name="register"', $form->render()); |
|
13 | + } |
|
14 | 14 | |
15 | - /** @test */ |
|
16 | - public function it_does_not_touch_the_model() |
|
17 | - { |
|
18 | - $model = $this->model(['register'=>'123']); |
|
15 | + /** @test */ |
|
16 | + public function it_does_not_touch_the_model() |
|
17 | + { |
|
18 | + $model = $this->model(['register'=>'123']); |
|
19 | 19 | |
20 | - $form = $this->form(); |
|
21 | - $form->button('register'); |
|
22 | - $form->fill($model); |
|
20 | + $form = $this->form(); |
|
21 | + $form->button('register'); |
|
22 | + $form->fill($model); |
|
23 | 23 | |
24 | - $form->assertEquals($model->register, '123'); |
|
25 | - } |
|
24 | + $form->assertEquals($model->register, '123'); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } |
@@ -4,85 +4,85 @@ |
||
4 | 4 | |
5 | 5 | class EmailTest extends FormTestCase { |
6 | 6 | |
7 | - /** @test */ |
|
8 | - public function it_can_be_rendered() |
|
9 | - { |
|
10 | - $form = $this->form(); |
|
11 | - $form->email('foo'); |
|
12 | - $this->assertContains('<input name="foo" value=""', $form->render()); |
|
13 | - } |
|
14 | - |
|
15 | - /** @test */ |
|
16 | - public function it_renders_a_default_value() |
|
17 | - { |
|
18 | - $form = $this->form(); |
|
19 | - $form->email('foo')->default('bar'); |
|
20 | - $this->assertContains('<input name="foo" value="bar"', $form->render()); |
|
21 | - } |
|
22 | - |
|
23 | - /** @test */ |
|
24 | - public function it_renders_model_values() |
|
25 | - { |
|
26 | - $form = $this->form(); |
|
27 | - $form->defaults($this->model(['foo'=>'bar'])); |
|
28 | - $form->email('foo'); |
|
29 | - $this->assertContains('<input name="foo" value="bar"', $form->render()); |
|
30 | - } |
|
31 | - |
|
32 | - /** @test */ |
|
33 | - public function it_can_fill_model_values() |
|
34 | - { |
|
35 | - $model = $this->model(['foo'=>'']); |
|
36 | - |
|
37 | - $form = $this->form(); |
|
38 | - $form->email('foo')->default('bar'); |
|
39 | - $form->fill($model); |
|
40 | - |
|
41 | - $form->assertEquals($model->foo, 'bar'); |
|
42 | - } |
|
43 | - |
|
44 | - /** @test */ |
|
45 | - public function it_escapes_value() |
|
46 | - { |
|
47 | - $form = $this->form(); |
|
48 | - $form->email('foo')->default('bar&'); |
|
49 | - $this->assertContains('<input name="foo" value="bar&"', $form->render()); |
|
50 | - } |
|
51 | - |
|
52 | - /** @test */ |
|
53 | - public function it_provides_expected_values() |
|
54 | - { |
|
55 | - $form = $this->form(); |
|
56 | - $form->email('foo'); |
|
57 | - |
|
58 | - $this->assertSame($form->get('foo'), ''); |
|
59 | - } |
|
60 | - |
|
61 | - /** @test */ |
|
62 | - public function it_provides_expected_default_values() |
|
63 | - { |
|
64 | - $form = $this->form(); |
|
65 | - $form->email('foo')->default('[email protected]'); |
|
66 | - |
|
67 | - $this->assertSame($form->get('foo'), '[email protected]'); |
|
68 | - } |
|
69 | - |
|
70 | - /** @test */ |
|
7 | + /** @test */ |
|
8 | + public function it_can_be_rendered() |
|
9 | + { |
|
10 | + $form = $this->form(); |
|
11 | + $form->email('foo'); |
|
12 | + $this->assertContains('<input name="foo" value=""', $form->render()); |
|
13 | + } |
|
14 | + |
|
15 | + /** @test */ |
|
16 | + public function it_renders_a_default_value() |
|
17 | + { |
|
18 | + $form = $this->form(); |
|
19 | + $form->email('foo')->default('bar'); |
|
20 | + $this->assertContains('<input name="foo" value="bar"', $form->render()); |
|
21 | + } |
|
22 | + |
|
23 | + /** @test */ |
|
24 | + public function it_renders_model_values() |
|
25 | + { |
|
26 | + $form = $this->form(); |
|
27 | + $form->defaults($this->model(['foo'=>'bar'])); |
|
28 | + $form->email('foo'); |
|
29 | + $this->assertContains('<input name="foo" value="bar"', $form->render()); |
|
30 | + } |
|
31 | + |
|
32 | + /** @test */ |
|
33 | + public function it_can_fill_model_values() |
|
34 | + { |
|
35 | + $model = $this->model(['foo'=>'']); |
|
36 | + |
|
37 | + $form = $this->form(); |
|
38 | + $form->email('foo')->default('bar'); |
|
39 | + $form->fill($model); |
|
40 | + |
|
41 | + $form->assertEquals($model->foo, 'bar'); |
|
42 | + } |
|
43 | + |
|
44 | + /** @test */ |
|
45 | + public function it_escapes_value() |
|
46 | + { |
|
47 | + $form = $this->form(); |
|
48 | + $form->email('foo')->default('bar&'); |
|
49 | + $this->assertContains('<input name="foo" value="bar&"', $form->render()); |
|
50 | + } |
|
51 | + |
|
52 | + /** @test */ |
|
53 | + public function it_provides_expected_values() |
|
54 | + { |
|
55 | + $form = $this->form(); |
|
56 | + $form->email('foo'); |
|
57 | + |
|
58 | + $this->assertSame($form->get('foo'), ''); |
|
59 | + } |
|
60 | + |
|
61 | + /** @test */ |
|
62 | + public function it_provides_expected_default_values() |
|
63 | + { |
|
64 | + $form = $this->form(); |
|
65 | + $form->email('foo')->default('[email protected]'); |
|
66 | + |
|
67 | + $this->assertSame($form->get('foo'), '[email protected]'); |
|
68 | + } |
|
69 | + |
|
70 | + /** @test */ |
|
71 | 71 | public function it_validates_required() |
72 | 72 | { |
73 | - $this->assertValid(function($form) { $form->email('foo'); }); |
|
73 | + $this->assertValid(function($form) { $form->email('foo'); }); |
|
74 | 74 | |
75 | - $this->assertNotValid(function($form) { $form->email('foo')->required(); }); |
|
76 | - } |
|
75 | + $this->assertNotValid(function($form) { $form->email('foo')->required(); }); |
|
76 | + } |
|
77 | 77 | |
78 | - /** @test */ |
|
78 | + /** @test */ |
|
79 | 79 | public function it_validates_email() |
80 | 80 | { |
81 | - $this->assertValid(function($form) { $form->email('foo')->default('[email protected]'); }); |
|
82 | - $this->assertValid(function($form) { $form->email('foo')->default('bar\'[email protected]'); }); |
|
81 | + $this->assertValid(function($form) { $form->email('foo')->default('[email protected]'); }); |
|
82 | + $this->assertValid(function($form) { $form->email('foo')->default('bar\'[email protected]'); }); |
|
83 | 83 | |
84 | - $this->assertNotValid(function($form) { $form->email('foo')->default('bar@invalid'); }); |
|
85 | - $this->assertNotValid(function($form) { $form->email('foo')->default('bar@inva\'lid.com'); }); |
|
86 | - } |
|
84 | + $this->assertNotValid(function($form) { $form->email('foo')->default('bar@invalid'); }); |
|
85 | + $this->assertNotValid(function($form) { $form->email('foo')->default('bar@inva\'lid.com'); }); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | } |