Example #1
0
 public function setData($collection)
 {
     if (!is_array($collection) && !$collection instanceof \Traversable) {
         throw new UnexpectedTypeException('The data must be an array');
     }
     foreach ($collection as $name => $value) {
         $this->add($this->newField($name, $name));
     }
     parent::setData($collection);
 }
Example #2
0
 public function testGetDataReturnsObject()
 {
     $group = new FieldGroup('author');
     $object = new \stdClass();
     $group->setData($object);
     $this->assertEquals($object, $group->getData());
 }