@@ -87,6 +87,76 @@ public function prepare()
8787 );
8888 }
8989
90+ public function testInitializeAnHorizontalFormClassWithFieldset ()
91+ {
92+ $ factory = new \Laminas \Form \Factory ();
93+
94+ $ form = $ factory ->create ([
95+ 'type ' => 'form ' ,
96+ 'elements ' => [
97+ [
98+ 'spec ' => [
99+ 'name ' => 'displayname ' ,
100+ 'options ' => [
101+ 'label ' => 'Display name ' ,
102+ 'column ' => 'sm-10 ' ,
103+ ],
104+ 'attributes ' => [
105+ 'type ' => 'text ' ,
106+ 'id ' => 'inputDisplayname1 ' ,
107+ 'placeholder ' => 'Display name ' ,
108+ ],
109+ ],
110+ ],
111+ [
112+ 'spec ' => [
113+ 'name ' => 'credentials ' ,
114+ 'type ' => \Laminas \Form \Fieldset::class,
115+ 'elements ' => [
116+ [
117+ 'spec ' => [
118+ 'name ' => 'email ' ,
119+ 'options ' => [
120+ 'label ' => 'Email ' ,
121+ 'column ' => 'sm-10 ' ,
122+ ],
123+ 'attributes ' => [
124+ 'type ' => 'email ' ,
125+ 'id ' => 'inputEmail3 ' ,
126+ 'placeholder ' => 'Email ' ,
127+ ],
128+ ],
129+ ],
130+ ],
131+ ],
132+ ],
133+ ],
134+ ]);
135+ $ form ->setOption ('layout ' , \TwbsHelper \Form \View \Helper \Form::LAYOUT_HORIZONTAL );
136+ $ this ->assertEquals (
137+ '<form id="form" method="POST" name="form" role="form"> ' . PHP_EOL .
138+ ' <div class="mb-3 row"> ' . PHP_EOL .
139+ ' <label class="col-form-label col-sm-2" for="inputDisplayname1"> ' .
140+ 'Display name</label> ' . PHP_EOL .
141+ ' <div class="col-sm-10"> ' . PHP_EOL .
142+ ' <input class="form-control" id="inputDisplayname1" name="displayname" placeholder="Display name" ' .
143+ 'type="text" value=""/> ' . PHP_EOL .
144+ ' </div> ' . PHP_EOL .
145+ ' </div> ' . PHP_EOL .
146+ ' <fieldset class="mb-3 row"> ' . PHP_EOL .
147+ ' <div class="mb-3 row"> ' . PHP_EOL .
148+ ' <label class="col-form-label col-sm-2" for="inputEmail3"> ' .
149+ 'Email</label> ' . PHP_EOL .
150+ ' <div class="col-sm-10"> ' . PHP_EOL .
151+ ' <input class="form-control" id="inputEmail3" name="credentials[email]" placeholder="Email" ' .
152+ 'type="email" value=""/> ' . PHP_EOL .
153+ ' </div> ' . PHP_EOL .
154+ ' </div> ' . PHP_EOL .
155+ ' </fieldset> ' . PHP_EOL .
156+ '</form> ' ,
157+ $ this ->formHelper ->__invoke ($ form )
158+ );
159+ }
90160
91161 public function testRenderSpecWithWrongFormElementThrowsAnException ()
92162 {
0 commit comments