</tr> EOF; $t->is($f->__toString(), fix_linebreaks($output), '->__toString() renders the form as HTML'); $output = <<<EOF <tr> <th><label for="first_name">First name</label></th> <td><input type="text" name="first_name" value="Fabien" class="foo" id="first_name" /></td> </tr> <tr> <th><label for="last_name">Last name</label></th> <td><input type="text" name="last_name" value="Potencier" id="last_name" /><input type="hidden" name="id" value="3" id="id" /></td> </tr> EOF; $t->is($f->render(array('first_name' => array('class' => 'foo'))), fix_linebreaks($output), '->render() renders the form as HTML'); $t->is((string) $f['id'], '<input type="hidden" name="id" value="3" id="id" />', '->offsetGet() returns a sfFormField'); $t->is((string) $f['first_name'], '<input type="text" name="first_name" value="Fabien" id="first_name" />', '->offsetGet() returns a sfFormField'); $t->is((string) $f['last_name'], '<input type="text" name="last_name" value="Potencier" id="last_name" />', '->offsetGet() returns a sfFormField'); // bound $f->bind(array('id' => '1', 'first_name' => 'Fabien', 'last_name' => 'Potencier')); $output = <<<EOF <tr> <th><label for="first_name">First name</label></th> <td><input type="text" name="first_name" value="Fabien" id="first_name" /></td> </tr> <tr> <th><label for="last_name">Last name</label></th> <td><input type="text" name="last_name" value="Potencier" id="last_name" /><input type="hidden" name="id" value="1" id="id" /></td> </tr>
</tr> EOF; $t->is($f->__toString(), $output, '->__toString() renders the form as HTML'); $output = <<<EOF <tr> <th><label for="first_name">First name</label></th> <td><input type="text" name="first_name" value="Fabien" class="foo" id="first_name" /></td> </tr> <tr> <th><label for="last_name">Last name</label></th> <td><input type="text" name="last_name" value="Potencier" id="last_name" /><input type="hidden" name="id" value="3" id="id" /></td> </tr> EOF; $t->is($f->render(array('first_name' => array('class' => 'foo'))), $output, '->render() renders the form as HTML'); $t->is((string) $f['id'], '<input type="hidden" name="id" value="3" id="id" />', '->offsetGet() returns a sfFormField'); $t->is((string) $f['first_name'], '<input type="text" name="first_name" value="Fabien" id="first_name" />', '->offsetGet() returns a sfFormField'); $t->is((string) $f['last_name'], '<input type="text" name="last_name" value="Potencier" id="last_name" />', '->offsetGet() returns a sfFormField'); // bound $f->bind(array('id' => '1', 'first_name' => 'Fabien', 'last_name' => 'Potencier')); $output = <<<EOF <tr> <th><label for="first_name">First name</label></th> <td><input type="text" name="first_name" value="Fabien" id="first_name" /></td> </tr> <tr> <th><label for="last_name">Last name</label></th> <td><input type="text" name="last_name" value="Potencier" id="last_name" /><input type="hidden" name="id" value="1" id="id" /></td> </tr>