PageRenderTime 166ms CodeModel.GetById 81ms app.highlight 19ms RepoModel.GetById 61ms app.codeStats 0ms

/testapp/modules/jelix_tests/tests/jforms.htmllightbuilder2.html_cli.php

https://bitbucket.org/doubleface/jelix-jpu
PHP | 372 lines | 314 code | 48 blank | 10 comment | 0 complexity | 248608343c7b98f26143247240568fc0 MD5 | raw file
  1<?php
  2/**
  3* @package     testapp
  4* @subpackage  unittest module
  5* @author      Jouanneau Laurent
  6* @contributor Julien Issler
  7* @copyright   2007-2008 Jouanneau laurent
  8* @copyright   2008 Julien Issler
  9* @link        http://www.jelix.org
 10* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
 11*/
 12
 13require_once(JELIX_LIB_PATH.'forms/jFormsBase.class.php');
 14require_once(JELIX_LIB_PATH.'forms/jFormsBuilderBase.class.php');
 15require_once(JELIX_LIB_PATH.'forms/jFormsDataContainer.class.php');
 16require_once(JELIX_LIB_PATH.'plugins/jforms/htmllight/htmllight.jformsbuilder.php');
 17
 18class testHTMLLightForm2 extends jFormsBase {
 19}
 20
 21class testJFormsHtmlLightBuilder2 extends htmllightJformsBuilder {
 22    function getJsContent() { $js= $this->jsContent; $this->jsContent = '';return $js;}
 23    function clearJs() { $this->jsContent = ''; }
 24}
 25
 26
 27class UTjformsHTMLLightBuilder2 extends jUnitTestCaseDb {
 28
 29    protected static $mysharedfixture;
 30    function testStart() {
 31        self::$mysharedfixture = new stdClass;
 32        self::$mysharedfixture->container = new jFormsDataContainer('formtestlightB','');
 33        self::$mysharedfixture->form = new testHTMLLightForm2('formtestlightB', self::$mysharedfixture->container, true );
 34        self::$mysharedfixture->builder = new testJFormsHtmlLightBuilder2(self::$mysharedfixture->form);
 35        self::$mysharedfixture->formname = self::$mysharedfixture->builder->getName();
 36    }
 37
 38    function testOutputGroup(){
 39
 40        $group= new jFormsControlgroup('identity');
 41        $group->label='Your identity';
 42
 43        $ctrl= new jFormsControlinput('nom');
 44        $ctrl->required=true;
 45        $ctrl->label='Your name';
 46        $group->addChildControl($ctrl);
 47
 48        $ctrl= new jFormsControlinput('prenom');
 49        $ctrl->defaultValue='robert';
 50        $ctrl->label='Your firstname';
 51        $group->addChildControl($ctrl);
 52
 53        $ctrl= new jFormsControlradiobuttons('sexe');
 54        $ctrl->required=true;
 55        $ctrl->label='Vous êtes ';
 56        $ctrl->alertRequired='Vous devez indiquer le sexe, même si vous ne savez pas :-)';
 57        $ctrl->datasource= new jFormsStaticDatasource();
 58        $ctrl->datasource->data = array(
 59        'h'=>'un homme',
 60        'f'=>'une femme',
 61        'no'=>'je ne sais pas',
 62        );
 63        $group->addChildControl($ctrl);
 64
 65        $ctrl= new jFormsControlinput('mail');
 66        $ctrl->datatype= new jDatatypeemail();
 67        $ctrl->label='Votre mail';
 68        $group->addChildControl($ctrl);
 69
 70        self::$mysharedfixture->form->addControl($group);
 71
 72
 73        ob_start();self::$mysharedfixture->builder->outputControlLabel($group);$out = ob_get_clean();
 74        $this->assertEqualOrDiff('', $out);
 75
 76
 77        $expected = '<fieldset><legend>Your identity</legend>'."\n";
 78        $expected .= '<table class="jforms-table-group" border="0">'."\n";
 79        $expected .= '<tr><th scope="row"><label class="jforms-label jforms-required" for="'.self::$mysharedfixture->formname.'_nom">Your name</label></th>'."\n";
 80        $expected .= '<td><input type="text" name="nom" id="'.self::$mysharedfixture->formname.'_nom" class=" jforms-required" value=""/></td></tr>'."\n";
 81        $expected .= '<tr><th scope="row"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_prenom">Your firstname</label></th>'."\n";
 82        $expected .= '<td><input type="text" name="prenom" id="'.self::$mysharedfixture->formname.'_prenom" value="robert"/></td></tr>'."\n";
 83        $expected .= '<tr><th scope="row"><span class="jforms-label jforms-required">Vous êtes </span></th>'."\n";
 84        $expected .= '<td><span class="jforms-radio jforms-ctl-sexe"><input type="radio" name="sexe" id="'.self::$mysharedfixture->formname.'_sexe_0" value="h" class=" jforms-required"/><label for="'.self::$mysharedfixture->formname.'_sexe_0">un homme</label></span>';
 85        $expected .= '<span class="jforms-radio jforms-ctl-sexe"><input type="radio" name="sexe" id="'.self::$mysharedfixture->formname.'_sexe_1" value="f" class=" jforms-required"/><label for="'.self::$mysharedfixture->formname.'_sexe_1">une femme</label></span>';
 86        $expected .= '<span class="jforms-radio jforms-ctl-sexe"><input type="radio" name="sexe" id="'.self::$mysharedfixture->formname.'_sexe_2" value="no" class=" jforms-required"/><label for="'.self::$mysharedfixture->formname.'_sexe_2">je ne sais pas</label></span></td></tr>'."\n";
 87        $expected .= '<tr><th scope="row"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_mail">Votre mail</label></th>'."\n";
 88        $expected .= '<td><input type="text" name="mail" id="'.self::$mysharedfixture->formname.'_mail" value=""/></td></tr>'."\n</table></fieldset>";
 89
 90
 91        ob_start();self::$mysharedfixture->builder->outputControl($group);$out = ob_get_clean();
 92        $this->assertEqualOrDiff($expected, $out);
 93        $this->assertEqualOrDiff('c = new jFormsControlString(\'nom\', \'Your name\');
 94c.required = true;
 95c.errRequired=\'"Your name" field is required\';
 96c.errInvalid=\'"Your name" field is invalid\';
 97jForms.tForm.addControl(c);
 98c = new jFormsControlString(\'prenom\', \'Your firstname\');
 99c.errInvalid=\'"Your firstname" field is invalid\';
100jForms.tForm.addControl(c);
101c = new jFormsControlString(\'sexe\', \'Vous êtes \');
102c.required = true;
103c.errRequired=\'Vous devez indiquer le sexe, même si vous ne savez pas :-)\';
104c.errInvalid=\'"Vous êtes " field is invalid\';
105jForms.tForm.addControl(c);
106c = new jFormsControlEmail(\'mail\', \'Votre mail\');
107c.errInvalid=\'"Votre mail" field is invalid\';
108jForms.tForm.addControl(c);
109', self::$mysharedfixture->builder->getJsContent());
110
111        $group->setReadOnly(true);
112        $expected = '<fieldset><legend>Your identity</legend>'."\n";
113        $expected .= '<table class="jforms-table-group" border="0">'."\n";
114        $expected .= '<tr><th scope="row"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_nom">Your name</label></th>'."\n";
115        $expected .= '<td><input type="text" name="nom" id="'.self::$mysharedfixture->formname.'_nom" readonly="readonly" class=" jforms-readonly" value=""/></td></tr>'."\n";
116        $expected .= '<tr><th scope="row"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_prenom">Your firstname</label></th>'."\n";
117        $expected .= '<td><input type="text" name="prenom" id="'.self::$mysharedfixture->formname.'_prenom" readonly="readonly" class=" jforms-readonly" value="robert"/></td></tr>'."\n";
118        $expected .= '<tr><th scope="row"><span class="jforms-label">Vous êtes </span></th>'."\n";
119        $expected .= '<td><span class="jforms-radio jforms-ctl-sexe"><input type="radio" name="sexe" id="'.self::$mysharedfixture->formname.'_sexe_0" value="h" readonly="readonly" class=" jforms-readonly"/><label for="'.self::$mysharedfixture->formname.'_sexe_0">un homme</label></span>';
120        $expected .= '<span class="jforms-radio jforms-ctl-sexe"><input type="radio" name="sexe" id="'.self::$mysharedfixture->formname.'_sexe_1" value="f" readonly="readonly" class=" jforms-readonly"/><label for="'.self::$mysharedfixture->formname.'_sexe_1">une femme</label></span>';
121        $expected .= '<span class="jforms-radio jforms-ctl-sexe"><input type="radio" name="sexe" id="'.self::$mysharedfixture->formname.'_sexe_2" value="no" readonly="readonly" class=" jforms-readonly"/><label for="'.self::$mysharedfixture->formname.'_sexe_2">je ne sais pas</label></span></td></tr>'."\n";
122        $expected .= '<tr><th scope="row"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_mail">Votre mail</label></th>'."\n";
123        $expected .= '<td><input type="text" name="mail" id="'.self::$mysharedfixture->formname.'_mail" readonly="readonly" class=" jforms-readonly" value=""/></td></tr>'."\n</table></fieldset>";
124        ob_start();self::$mysharedfixture->builder->outputControl($group);$out = ob_get_clean();
125        $this->assertEqualOrDiff($expected, $out);
126        $this->assertEqualOrDiff('c = new jFormsControlString(\'nom\', \'Your name\');
127c.required = true;
128c.errRequired=\'"Your name" field is required\';
129c.errInvalid=\'"Your name" field is invalid\';
130jForms.tForm.addControl(c);
131c = new jFormsControlString(\'prenom\', \'Your firstname\');
132c.errInvalid=\'"Your firstname" field is invalid\';
133jForms.tForm.addControl(c);
134c = new jFormsControlString(\'sexe\', \'Vous êtes \');
135c.required = true;
136c.errRequired=\'Vous devez indiquer le sexe, même si vous ne savez pas :-)\';
137c.errInvalid=\'"Vous êtes " field is invalid\';
138jForms.tForm.addControl(c);
139c = new jFormsControlEmail(\'mail\', \'Votre mail\');
140c.errInvalid=\'"Votre mail" field is invalid\';
141jForms.tForm.addControl(c);
142', self::$mysharedfixture->builder->getJsContent());
143
144    }
145
146
147    function testOutputChoice(){
148
149        $choice= new jFormsControlChoice('status');
150        $choice->label='Task Status';
151        $choice->createItem('new','New');
152        $choice->createItem('assigned','Assigned');
153        $choice->createItem('closed','Closed');
154
155        $ctrl= new jFormsControlinput('nom');
156        $ctrl->required=true;
157        $ctrl->label='Name';
158        $choice->addChildControl($ctrl,'assigned');
159
160
161        $ctrl= new jFormsControlinput('prenom');
162        $ctrl->defaultValue='robert';
163        $ctrl->label='Firstname';
164        $choice->addChildControl($ctrl,'assigned');
165
166        $ctrl= new jFormsControlMenulist('reason');
167        $ctrl->required=true;
168        $ctrl->label='Reason ';
169        $ctrl->alertRequired='Hey, specify a reason !';
170        $ctrl->datasource= new jFormsStaticDatasource();
171        $ctrl->datasource->data = array(
172        'aa'=>'fixed',
173        'bb'=>'won t fixed',
174        'cc'=>'later',
175        );
176        $choice->addChildControl($ctrl,'closed');
177
178        self::$mysharedfixture->form->addControl($choice);
179
180
181        ob_start();self::$mysharedfixture->builder->outputControlLabel($choice);$out = ob_get_clean();
182        $this->assertEqualOrDiff('<label class="jforms-label" for="'.self::$mysharedfixture->formname.'_status">Task Status</label>', $out);
183
184
185        $expected = '<ul class="jforms-choice jforms-ctl-status" >'."\n";
186        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_0" value="new" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'new\')"/>New</label> </li>'."\n";
187        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_1" value="assigned" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'assigned\')"/>Assigned</label>  <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_nom">Name</label> <input type="text" name="nom" id="'.self::$mysharedfixture->formname.'_nom" readonly="readonly" class=" jforms-readonly" value=""/></span>'."\n";
188        $expected .= ' <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_prenom">Firstname</label> <input type="text" name="prenom" id="'.self::$mysharedfixture->formname.'_prenom" readonly="readonly" class=" jforms-readonly" value="robert"/></span>'."\n";
189        $expected .= '</li>'."\n";
190        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_2" value="closed" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'closed\')"/>Closed</label>  <span class="jforms-item-controls"><label class="jforms-label jforms-required" for="'.self::$mysharedfixture->formname.'_reason">Reason </label> <select name="reason" id="'.self::$mysharedfixture->formname.'_reason" class=" jforms-required" size="1"><option value="aa">fixed</option><option value="bb">won t fixed</option><option value="cc">later</option></select></span>'."\n";
191        $expected .= '</li>'."\n";
192        $expected .= '</ul>'."\n";
193        ob_start();self::$mysharedfixture->builder->outputControl($choice);$out = ob_get_clean();
194        $this->assertEqualOrDiff($expected, $out);
195        $this->assertEqualOrDiff('c = new jFormsControlChoice(\'status\', \'Task Status\');
196c.errInvalid=\'"Task Status" field is invalid\';
197jForms.tForm.addControl(c);
198c2 = c;
199c2.items[\'new\']=[];
200c = new jFormsControlString(\'nom\', \'Name\');
201c.required = true;
202c.errRequired=\'"Name" field is required\';
203c.errInvalid=\'"Name" field is invalid\';
204c2.addControl(c, \'assigned\');
205c = new jFormsControlString(\'prenom\', \'Firstname\');
206c.errInvalid=\'"Firstname" field is invalid\';
207c2.addControl(c, \'assigned\');
208c = new jFormsControlString(\'reason\', \'Reason \');
209c.required = true;
210c.errRequired=\'Hey, specify a reason !\';
211c.errInvalid=\'"Reason " field is invalid\';
212c2.addControl(c, \'closed\');
213c2.activate(\'\');
214', self::$mysharedfixture->builder->getJsContent());
215
216        self::$mysharedfixture->form->getContainer()->data['status']='assigned';
217
218        $expected = '<ul class="jforms-choice jforms-ctl-status" >'."\n";
219        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_0" value="new" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'new\')"/>New</label> </li>'."\n";
220        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_1" value="assigned" checked="checked" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'assigned\')"/>Assigned</label>  <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_nom">Name</label> <input type="text" name="nom" id="'.self::$mysharedfixture->formname.'_nom" readonly="readonly" class=" jforms-readonly" value=""/></span>'."\n";
221        $expected .= ' <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_prenom">Firstname</label> <input type="text" name="prenom" id="'.self::$mysharedfixture->formname.'_prenom" readonly="readonly" class=" jforms-readonly" value="robert"/></span>'."\n";
222        $expected .= '</li>'."\n";
223        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_2" value="closed" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'closed\')"/>Closed</label>  <span class="jforms-item-controls"><label class="jforms-label jforms-required" for="'.self::$mysharedfixture->formname.'_reason">Reason </label> <select name="reason" id="'.self::$mysharedfixture->formname.'_reason" class=" jforms-required" size="1"><option value="aa">fixed</option><option value="bb">won t fixed</option><option value="cc">later</option></select></span>'."\n";
224        $expected .= '</li>'."\n";
225        $expected .= '</ul>'."\n";
226        ob_start();self::$mysharedfixture->builder->outputControl($choice);$out = ob_get_clean();
227        $this->assertEqualOrDiff($expected, $out);
228        $this->assertEqualOrDiff('c = new jFormsControlChoice(\'status\', \'Task Status\');
229c.errInvalid=\'"Task Status" field is invalid\';
230jForms.tForm.addControl(c);
231c2 = c;
232c2.items[\'new\']=[];
233c = new jFormsControlString(\'nom\', \'Name\');
234c.required = true;
235c.errRequired=\'"Name" field is required\';
236c.errInvalid=\'"Name" field is invalid\';
237c2.addControl(c, \'assigned\');
238c = new jFormsControlString(\'prenom\', \'Firstname\');
239c.errInvalid=\'"Firstname" field is invalid\';
240c2.addControl(c, \'assigned\');
241c = new jFormsControlString(\'reason\', \'Reason \');
242c.required = true;
243c.errRequired=\'Hey, specify a reason !\';
244c.errInvalid=\'"Reason " field is invalid\';
245c2.addControl(c, \'closed\');
246c2.activate(\'assigned\');
247', self::$mysharedfixture->builder->getJsContent());
248
249        self::$mysharedfixture->form->getContainer()->data['status']='new';
250        $expected = '<ul class="jforms-choice jforms-ctl-status" >'."\n";
251        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_0" value="new" checked="checked" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'new\')"/>New</label> </li>'."\n";
252        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_1" value="assigned" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'assigned\')"/>Assigned</label>  <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_nom">Name</label> <input type="text" name="nom" id="'.self::$mysharedfixture->formname.'_nom" readonly="readonly" class=" jforms-readonly" value=""/></span>'."\n";
253        $expected .= ' <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_prenom">Firstname</label> <input type="text" name="prenom" id="'.self::$mysharedfixture->formname.'_prenom" readonly="readonly" class=" jforms-readonly" value="robert"/></span>'."\n";
254        $expected .= '</li>'."\n";
255        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_2" value="closed" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'closed\')"/>Closed</label>  <span class="jforms-item-controls"><label class="jforms-label jforms-required" for="'.self::$mysharedfixture->formname.'_reason">Reason </label> <select name="reason" id="'.self::$mysharedfixture->formname.'_reason" class=" jforms-required" size="1"><option value="aa">fixed</option><option value="bb">won t fixed</option><option value="cc">later</option></select></span>'."\n";
256        $expected .= '</li>'."\n";
257        $expected .= '</ul>'."\n";
258        ob_start();self::$mysharedfixture->builder->outputControl($choice);$out = ob_get_clean();
259        $this->assertEqualOrDiff($expected, $out);
260        $this->assertEqualOrDiff('c = new jFormsControlChoice(\'status\', \'Task Status\');
261c.errInvalid=\'"Task Status" field is invalid\';
262jForms.tForm.addControl(c);
263c2 = c;
264c2.items[\'new\']=[];
265c = new jFormsControlString(\'nom\', \'Name\');
266c.required = true;
267c.errRequired=\'"Name" field is required\';
268c.errInvalid=\'"Name" field is invalid\';
269c2.addControl(c, \'assigned\');
270c = new jFormsControlString(\'prenom\', \'Firstname\');
271c.errInvalid=\'"Firstname" field is invalid\';
272c2.addControl(c, \'assigned\');
273c = new jFormsControlString(\'reason\', \'Reason \');
274c.required = true;
275c.errRequired=\'Hey, specify a reason !\';
276c.errInvalid=\'"Reason " field is invalid\';
277c2.addControl(c, \'closed\');
278c2.activate(\'new\');
279', self::$mysharedfixture->builder->getJsContent());
280
281        self::$mysharedfixture->form->getContainer()->data['status']='closed';
282        $expected = '<ul class="jforms-choice jforms-ctl-status" >'."\n";
283        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_0" value="new" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'new\')"/>New</label> </li>'."\n";
284        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_1" value="assigned" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'assigned\')"/>Assigned</label>  <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_nom">Name</label> <input type="text" name="nom" id="'.self::$mysharedfixture->formname.'_nom" readonly="readonly" class=" jforms-readonly" value=""/></span>'."\n";
285        $expected .= ' <span class="jforms-item-controls"><label class="jforms-label" for="'.self::$mysharedfixture->formname.'_prenom">Firstname</label> <input type="text" name="prenom" id="'.self::$mysharedfixture->formname.'_prenom" readonly="readonly" class=" jforms-readonly" value="robert"/></span>'."\n";
286        $expected .= '</li>'."\n";
287        $expected .= '<li><label><input type="radio" name="status" id="'.self::$mysharedfixture->formname.'_status_2" value="closed" checked="checked" onclick="jForms.getForm(\'\').getControl(\'status\').activate(\'closed\')"/>Closed</label>  <span class="jforms-item-controls"><label class="jforms-label jforms-required" for="'.self::$mysharedfixture->formname.'_reason">Reason </label> <select name="reason" id="'.self::$mysharedfixture->formname.'_reason" class=" jforms-required" size="1"><option value="aa">fixed</option><option value="bb">won t fixed</option><option value="cc">later</option></select></span>'."\n";
288        $expected .= '</li>'."\n";
289        $expected .= '</ul>'."\n";
290        ob_start();self::$mysharedfixture->builder->outputControl($choice);$out = ob_get_clean();
291        $this->assertEqualOrDiff($expected, $out);
292        $this->assertEqualOrDiff('c = new jFormsControlChoice(\'status\', \'Task Status\');
293c.errInvalid=\'"Task Status" field is invalid\';
294jForms.tForm.addControl(c);
295c2 = c;
296c2.items[\'new\']=[];
297c = new jFormsControlString(\'nom\', \'Name\');
298c.required = true;
299c.errRequired=\'"Name" field is required\';
300c.errInvalid=\'"Name" field is invalid\';
301c2.addControl(c, \'assigned\');
302c = new jFormsControlString(\'prenom\', \'Firstname\');
303c.errInvalid=\'"Firstname" field is invalid\';
304c2.addControl(c, \'assigned\');
305c = new jFormsControlString(\'reason\', \'Reason \');
306c.required = true;
307c.errRequired=\'Hey, specify a reason !\';
308c.errInvalid=\'"Reason " field is invalid\';
309c2.addControl(c, \'closed\');
310c2.activate(\'closed\');
311', self::$mysharedfixture->builder->getJsContent());
312    }
313
314    public function testFormWithExternalUrlAsAction(){
315        self::$mysharedfixture->builder->setAction('http://www.jelix.org/dummy.php',array());
316        ob_start();
317        self::$mysharedfixture->builder->outputHeader(array('method'=>'post'));
318        $out = ob_get_clean();
319
320        $result ='<form action="http://www.jelix.org/dummy.php" method="post" id="'.self::$mysharedfixture->builder->getName().'"><script type="text/javascript">
321//<![CDATA[
322jForms.tForm = new jFormsForm(\'jforms_formtestlightB\');
323jForms.tForm.setErrorDecorator(new jFormsErrorDecoratorAlert());
324jForms.tForm.setHelpDecorator(new jFormsHelpDecoratorAlert());
325jForms.declareForm(jForms.tForm);
326//]]>
327</script><div class="jforms-hiddens"><input type="hidden" name="__JFORMS_TOKEN__" value="'.self::$mysharedfixture->container->token.'"/>
328</div>';
329
330        $this->assertEqualOrDiff($result, $out);
331        $this->assertEqualOrDiff('', self::$mysharedfixture->builder->getJsContent());
332
333        self::$mysharedfixture->builder->setAction('http://www.jelix.org/dummy.php',array('foo'=>'bar'));
334        ob_start();
335        self::$mysharedfixture->builder->outputHeader(array('method'=>'post'));
336        $out = ob_get_clean();
337
338        $result ='<form action="http://www.jelix.org/dummy.php" method="post" id="'.self::$mysharedfixture->builder->getName().'"><script type="text/javascript">
339//<![CDATA[
340jForms.tForm = new jFormsForm(\'jforms_formtestlightB1\');
341jForms.tForm.setErrorDecorator(new jFormsErrorDecoratorAlert());
342jForms.tForm.setHelpDecorator(new jFormsHelpDecoratorAlert());
343jForms.declareForm(jForms.tForm);
344//]]>
345</script><div class="jforms-hiddens"><input type="hidden" name="foo" value="bar"/>
346<input type="hidden" name="__JFORMS_TOKEN__" value="'.self::$mysharedfixture->container->token.'"/>
347</div>';
348
349        $this->assertEqualOrDiff($result, $out);
350        $this->assertEqualOrDiff('', self::$mysharedfixture->builder->getJsContent());
351
352        self::$mysharedfixture->builder->setAction('https://www.jelix.org/dummy.php',array());
353        ob_start();
354        self::$mysharedfixture->builder->outputHeader(array('method'=>'get'));
355        $out = ob_get_clean();
356
357        $result ='<form action="https://www.jelix.org/dummy.php" method="get" id="'.self::$mysharedfixture->builder->getName().'"><script type="text/javascript">
358//<![CDATA[
359jForms.tForm = new jFormsForm(\'jforms_formtestlightB2\');
360jForms.tForm.setErrorDecorator(new jFormsErrorDecoratorAlert());
361jForms.tForm.setHelpDecorator(new jFormsHelpDecoratorAlert());
362jForms.declareForm(jForms.tForm);
363//]]>
364</script><div class="jforms-hiddens"><input type="hidden" name="__JFORMS_TOKEN__" value="'.self::$mysharedfixture->container->token.'"/>
365</div>';
366
367        $this->assertEqualOrDiff($result, $out);
368        $this->assertEqualOrDiff('', self::$mysharedfixture->builder->getJsContent());
369
370    }
371}
372