Exemple #1
0
 public function testReset()
 {
     $element = $this->getMock('\\Foundation\\Form\\Element');
     $element->expects($this->any())->method('getName')->will($this->returnCallback('uniqid'));
     $form = new \Foundation\Form();
     $field = $form->newField();
     $field->addElement($element);
     $field->addElement($element);
     $field->addElement($element);
     $form->newField();
     $form->newField();
     $form->newField();
     $this->assertEquals(3, count($form->getElements()));
     $this->assertEquals(6, count($form->getFields()));
     $form->reset();
     $this->assertEquals(2, count($form->getFields()));
     $this->assertEmpty($form->getElements());
 }