| 1 |  |  | <?php declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * This file is part of FlexPHP. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * (c) Freddie Gar <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | namespace FlexPHP\Inputs\Tests\Unit\Builder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use FlexPHP\Inputs\Builder\InputBuilder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use FlexPHP\Inputs\Tests\TestCase; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | class InputBuilderTest extends TestCase | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 16 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     public function testItDefault(): void | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |         $render = (new InputBuilder('foo', []))->render(); | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |         $this->assertEquals(<<<T | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  | T | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     public function testItDefaultSlug(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         $render = (new InputBuilder('foo_bar', []))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | <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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * @dataProvider getDefaultWithSpacesOptions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @param mixed $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     public function testItDefaultSpace($name): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         $render = (new InputBuilder($name, []))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | <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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     public function testItSetLabel(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |             'label' => 'My Label', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | <div class="form-group"><label for="form_foo">My Label</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     public function testItSetLabelAttr(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |             'label' => 'My Label', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |             'label_attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |                 'class' => 'label-class', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | <div class="form-group"><label class="label-class" for="form_foo">My Label</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     public function testItSetDefault(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             'default' => 'fuz', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | <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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     public function testItSetType(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |             'type' => 'email', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="email" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     public function testItSetRequired(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | <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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      * @dataProvider getRequiredOptions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      * @param array|string $required | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     public function testItSetRequiredConstraint($required): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |             'constraints' => $required, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | <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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |      * @dataProvider getNotRequiredOptions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @param array|string $required | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     public function testItSetNotRequiredConstraint($required): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             'constraints' => $required, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |     public function testItSetTypeConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |                 'type' => 'email', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="email" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     public function testItSetTypeAttrConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |             'attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |                 'type' => 'email', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="email" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |     public function testItSetDigitsConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                 'type' => 'digits', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-type="digits" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     public function testItSetAlphanumConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |                 'type' => 'Alphanum', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-type="alphanum" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     public function testItSetMinLengthConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |                 'minlength' => 5, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" minlength="5" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |     public function testItSetMaxLengthConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                 'maxlength' => 666, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" maxlength="666" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |     public function testItSetLengthConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |                 'length' => '[6,10]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-length="[6,10]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     public function testItSetMinConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |                 'min' => 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" min="3" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |     public function testItSetMaxConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |                 'max' => 99, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" max="99" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |     public function testItSetRangeConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |                 'range' => '6,10', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  | <div class="form-group"><label for="form_foo">Foo</label>        <input type="range" id="form_foo" name="form[foo]" min="6" max="10" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |     public function testItSetPatternConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |                 'pattern' => "\+d", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" pattern="\+d" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |     public function testItSetMinCheckConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |                 'mincheck' => '3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-mincheck="3" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |     public function testItSetMaxCheckConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                 'maxcheck' => 5, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-maxcheck="5" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |     public function testItSetCheckConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |                 'check' => '[1,3]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-check="[1,3]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |     public function testItSetEqualToConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |                 'equalto' => '#another', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-equalto="#another" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |     public function testItSetDataParsleyConstraint(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |             'constraints' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |                 'data-parsley-validator-foo' => '#bar', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" data-parsley-validator-foo="#bar" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |     public function testItSetHelp(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |             'help' => 'A help block', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  | <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> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |     public function testItSetHelpAttr(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |             'help' => 'A help block', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |             'help_attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |                 'class' => 'help-class', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  | <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="help-class form-text text-muted">A help block</small></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |     public function testItSetHelpHtml(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |             'help' => '<a href="link">A help block</a>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |             'help_html' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  | <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 href="link">A help block</a></small></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |     public function testItSetAttrExtra(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |             'attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |                 'class' => 'input-class', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="input-class form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |     public function testItSetAttrExtraWithEmptyData(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |             'attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |                 'class' => 'input-class', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |             'empty_data' => 'default', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="input-class form-control" placeholder="default" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |     public function testItSetEmptyDataWithAttrExtra(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |             'empty_data' => 'default', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |             'attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |                 'class' => 'input-class', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" placeholder="default" class="input-class form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |     public function testItSetDisabled(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |             'disabled' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" disabled="disabled" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |     public function testItSetEmptyData(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |             'empty_data' => 'default', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  | <div class="form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" placeholder="default" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |     public function testItSetRowAttr(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |         $this->markTestSkipped('Not works...'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |         $render = (new InputBuilder('foo', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |             'row_attr' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |                 'class' => 'row-class', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |         ]))->render(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         $this->assertEquals(<<<T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  | <div class="row-class form-group"><label for="form_foo">Foo</label><input type="text" id="form_foo" name="form[foo]" class="form-control" /></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  | T | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  | , $render); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |     public function getDefaultWithSpacesOptions(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |             ['foo bar'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |             ['foo  bar'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |             [' foo bar '], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |             [' foo bar'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |             ['foo bar '], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |             ['  foo  bar  '], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |     public function getRequiredOptions(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |             [['required']], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |             [['required' => true]], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |             [['required' => 'true']], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |             [['required' => 'required']], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |     public function getNotRequiredOptions(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |             [['required' => false]], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |             [['required' => 'false']], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 526 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 527 |  |  |  |