コード例 #1
0
ファイル: FormHandlerTest.php プロジェクト: andyvenus/form
 public function testNamedArrayFields()
 {
     $form = new FormBlueprint();
     $form->add('colours[red]', 'text', array('default' => '#FF0000'));
     $form->add('colours[green]', 'text', array('default' => '#00FF00'));
     $form->add('colours[blue]', 'text', array('default' => '#0000FF'));
     $form_handler = new FormHandler($form);
     $data = $form_handler->getData('colours');
     $this->assertEquals('#0000FF', $data['blue']);
     $form_view = $form_handler->createView();
     $this->assertEquals(3, count($form_view->colours['fields']));
     $this->assertEquals('colours[red]', $form_view->colours['fields']['red']['name']);
     $this->assertEquals('colours[blue]', $form_view->colours['fields']['blue']['name']);
 }