/** * {@inheritdoc} */ public function val($value = null) { if ($value === null) { return parent::val(); } $this->children = []; $this->valid = null; if ($value) { foreach ($value as $v) { $this->pushVal($v); } } return $this; }
/** * @depends testBase */ public function testValue(Group $field) { $field->val(['name' => 'Oscar', 'email' => '*****@*****.**', 'age' => '35', 'image' => ['name' => '1.png', 'type' => 'image/png', 'tmp_name' => '/tmp/phpTobJ71', 'error' => 0, 'size' => 2297]]); $this->assertCount(4, $field->val()); $this->assertEquals('Oscar', $field['name']->val()); }