$expected = <<<EOF <tr> <th>W4</th> <td> <table> <tr> <th><label for="w4_w3">W3</label></th> <td><input type="text" name="w4[w3]" id="w4_w3" /></td> </tr> </table> <input type="hidden" name="w1" id="w1" /> </td> </tr> EOF; $t->is(str_replace("\n", '', preg_replace('/^ +/m', '', $w->render(null))), str_replace("\n", '', preg_replace('/^ +/m', '', fix_linebreaks($expected))), '->render() is able to render widget schema that only contains hidden fields when the last field is a form'); // __clone() $t->diag('__clone()'); $w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2)); $w1->setParent($w); $w2->setParent($w); $format1 = new sfWidgetFormSchemaFormatterList($w); $format1->setTranslationCatalogue('english'); $w->addFormFormatter('testFormatter', $format1); $w1 = clone $w; $f1 = $w1->getFields(); $f = $w->getFields(); $t->is(array_keys($f1), array_keys($f), '__clone() clones embedded widgets'); foreach ($f1 as $name => $widget) { $t->ok($widget !== $f[$name], '__clone() clones embedded widgets'); $t->ok($widget->getParent() === $w1, 'The parents hafe been changed');