Ejemplo n.º 1
0
 public function testPopulateValuesWithFirstKeyGreaterThanZero()
 {
     $inputData = array(1 => array('name' => 'black'), 5 => array('name' => 'white'));
     // Standalone Collection element
     $collection = new Collection('fieldsets', array('count' => 1, 'target_element' => new \ZendTest\Form\TestAsset\CategoryFieldset()));
     $form = new Form();
     $form->add(array('type' => 'Zend\\Form\\Element\\Collection', 'name' => 'collection', 'options' => array('count' => 1, 'target_element' => new \ZendTest\Form\TestAsset\CategoryFieldset())));
     // Collection element attached to a form
     $formCollection = $form->get('collection');
     $collection->populateValues($inputData);
     $formCollection->populateValues($inputData);
     $this->assertEquals(count($collection->getFieldsets()), count($inputData));
     $this->assertEquals(count($formCollection->getFieldsets()), count($inputData));
 }