$w['w3']['w2'] = new sfWidgetFormInputHidden(); $errors = array('global error', 'w1' => 'error for w1', 'w2' => 'error for w2', 'w4' => array('w1' => 'error for w4/w1', 'w2' => 'error for w4/w2', 'w3' => 'error for w4/w3'), 'w4' => 'error for w4'); $t->is($w->getGlobalErrors($errors), array('global error', 'error for w4', 'W2' => 'error for w2'), '->getGlobalErrors() returns an array of global errors, errors for hidden fields, and errors for non existent fields'); // ->render() $t->diag('->render()'); $w = new sfWidgetFormSchema(); try { $w->render(null, 'string'); $t->fail('->render() throws an InvalidArgumentException if the second argument is not an array'); } catch (InvalidArgumentException $e) { $t->pass('->render() throws an InvalidArgumentException if the second argument is not an array'); } $w['first_name'] = $w1; $w['last_name'] = $w2; $w['id'] = new sfWidgetFormInputHidden(); $w->setAttribute('style', 'padding: 5px'); $w->setNameFormat('article[%s]'); $w->setIdFormat('id_%s'); $expected = <<<EOF <tr><td colspan="2"> <ul class="error_list"> <li>Global error message</li> <li>Id: Required</li> </ul> </td></tr> <tr> <th><label style="padding: 5px" for="id_article_first_name">First name</label></th> <td> <ul class="error_list"> <li>Too short</li> </ul> <input class="foo" type="text" name="article[first_name]" value="Fabien" id="id_article_first_name" /></td>