PageRenderTime 413ms CodeModel.GetById 81ms app.highlight 231ms RepoModel.GetById 81ms app.codeStats 2ms

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

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