Changeset 9209
- Timestamp:
- 05/23/08 09:48:41 (4 months ago)
- Files:
-
- branches/1.0/lib/util/sfFillInForm.class.php (modified) (2 diffs)
- branches/1.0/test/unit/util/sfFillInFormTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/util/sfFillInForm.class.php
r9189 r9209 41 41 } 42 42 43 /** 44 * fills in the values and returns HTML. This is a non validating tolerant mode. 45 * 46 * @return HTML with values filled in 47 */ 43 48 public function fillInHtml($html, $formName, $formId, $values) 44 49 { … … 65 70 } 66 71 72 /** 73 * fills in the values and returns XHTML. This is same as XML but stripts the XML Prolog. 74 * 75 * @return XHTML without prolog with values filled in 76 */ 77 public function fillInXhtml($xml, $formName, $formId, $values) 78 { 79 $xhtml = $this->fillInXml($xml, $formName, $formId, $values); 80 $prolog_regexp = '/^' . preg_quote('<?xml version="1.0"?>') . '\s*/'; 81 return preg_replace($prolog_regexp, '', $xhtml); 82 } 83 84 /** 85 * fills in the values and returns XHTML. It can only work correctly on validating XHTML. 86 * 87 * @return XHTML including XML prolog with values filled in 88 */ 67 89 public function fillInXml($xml, $formName, $formId, $values) 68 90 { branches/1.0/test/unit/util/sfFillInFormTest.php
r8709 r9209 12 12 require_once($_test_dir.'/../lib/util/sfFillInForm.class.php'); 13 13 14 $t = new lime_test(6 1, new lime_output_color());14 $t = new lime_test(64, new lime_output_color()); 15 15 16 16 $html = <<<EOF … … 264 264 $xml = $f->fillInXml($xml, 'form', null, array('foo' => 'bar')); 265 265 $t->like($xml, '#<input type="text" name="foo" value="bar"\s*/>#', '->fillInXml() outputs valid XML'); 266 $t->like($xml, '#<\?xml version="1.0"\?>#', '->fillInXml() outputs XML prolog'); 267 268 // ->fillInXhtml() 269 $xml = $f->fillInXhtml($xml, 'form', null, array('foo' => 'bar')); 270 $t->like($xml, '#<input type="text" name="foo" value="bar"\s*/>#', '->fillInXml() outputs valid XML'); 271 $t->unlike($xml, '#<\?xml version="1.0"\?>#', '->fillInXhtml() does not output XML prolog'); 266 272 267 273 // ->fillInHtml()