public function testCanPopulate() { $testForm = new Form(); $testElement1 = $this->getMockBuilder('Vascowhite\\Forms\\Elements\\Text')->disableOriginalConstructor()->getMock(); $testElement1->expects($this->any())->method('getName')->will($this->returnValue('testElement1')); $testElement1->expects($this->once())->method('setAttribute'); $testElement2 = $this->getMockBuilder('Vascowhite\\Forms\\Elements\\Text')->disableOriginalConstructor()->getMock(); $testElement2->expects($this->any())->method('getName')->will($this->returnValue('testElement2')); $testElement2->expects($this->once())->method('setAttribute'); $testForm->addElement($testElement1); $testForm->addElement($testElement2); $testForm->populate(['testElement1' => 'testdata1', 'testElement2' => 'testdata2']); }