@@ -12,7 +12,3 @@ |
||
| 12 | 12 | $render = Input::text('foo'); |
| 13 | 13 | |
| 14 | 14 | $this->assertEquals(<<<'T' |
| 15 | -<div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> |
|
| 16 | -T, $render); |
|
| 17 | - } |
|
| 18 | -} |
|
@@ -25,86 +25,3 @@ |
||
| 25 | 25 | $render = $this->getMock('foo', TextType::class, [])->render(); |
| 26 | 26 | |
| 27 | 27 | $this->assertEquals(<<<'T' |
| 28 | -<div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> |
|
| 29 | -T, $render); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - public function testItDefaultSlug(): void |
|
| 33 | - { |
|
| 34 | - $render = $this->getMock('foo_bar', TextType::class, [])->render(); |
|
| 35 | - |
|
| 36 | - $this->assertEquals(<<<'T' |
|
| 37 | -<div class="form-group"><label for="form_foo_bar">Foo bar</label><input type="text" id="form_foo_bar" name="form[foo_bar]" class="form-control" /></div> |
|
| 38 | -T, $render); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - public function testItDefaultSpace(): void |
|
| 42 | - { |
|
| 43 | - $render = $this->getMock('foo bar', TextType::class, [])->render(); |
|
| 44 | - |
|
| 45 | - $this->assertEquals(<<<'T' |
|
| 46 | -<div class="form-group"><label for="form_foo_bar">Foo bar</label><input type="text" id="form_foo_bar" name="form[foo_bar]" class="form-control" /></div> |
|
| 47 | -T, $render); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - public function testItSetLabel(): void |
|
| 51 | - { |
|
| 52 | - $render = $this->getMock('foo', TextType::class, [ |
|
| 53 | - 'Label' => 'My Label', |
|
| 54 | - ])->render(); |
|
| 55 | - |
|
| 56 | - $this->assertEquals(<<<'T' |
|
| 57 | -<div class="form-group"><label for="form_foo">My Label</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> |
|
| 58 | -T, $render); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - public function testItSetDefault(): void |
|
| 62 | - { |
|
| 63 | - $render = $this->getMock('foo', TextType::class, [ |
|
| 64 | - 'Default' => 'fuz', |
|
| 65 | - ])->render(); |
|
| 66 | - |
|
| 67 | - $this->assertEquals(<<<'T' |
|
| 68 | -<div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="form-control" value="fuz" /></div> |
|
| 69 | -T, $render); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * @dataProvider getRequiredOptions |
|
| 74 | - * |
|
| 75 | - * @param string|array $required |
|
| 76 | - * @return void |
|
| 77 | - */ |
|
| 78 | - public function testItSetRequiredConstraint($required): void |
|
| 79 | - { |
|
| 80 | - $render = $this->getMock('foo', TextType::class, [ |
|
| 81 | - 'Constraints' => $required, |
|
| 82 | - ])->render(); |
|
| 83 | - |
|
| 84 | - $this->assertEquals(<<<'T' |
|
| 85 | -<div class="form-group"><label for="form_foo" class="required">Foo</label><input type="text" id="form_foo" name="form[foo]" required="required" class="form-control" /></div> |
|
| 86 | -T, $render); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public function testItSetInputHelp(): void |
|
| 90 | - { |
|
| 91 | - $render = $this->getMock('foo', TextType::class, [ |
|
| 92 | - 'InputHelp' => 'A help block', |
|
| 93 | - ])->render(); |
|
| 94 | - |
|
| 95 | - $this->assertEquals(<<<'T' |
|
| 96 | -<div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" aria-describedby="form_foo_help" class="form-control" /><small id="form_foo_help" class="form-text text-muted">A help block</small></div> |
|
| 97 | -T, $render); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - public function getRequiredOptions(): array |
|
| 101 | - { |
|
| 102 | - return [ |
|
| 103 | - [\json_encode(['required'])], |
|
| 104 | - [\json_encode(['required' => true])], |
|
| 105 | - [\json_encode(['required' => 'true'])], |
|
| 106 | - [\json_encode(['required' => 'required'])], |
|
| 107 | - ['required'], |
|
| 108 | - ]; |
|
| 109 | - } |
|
| 110 | -} |
|