public function testIsGettingTransformedValue() { $typeHandler = $this->prophesize(TypeHandler::class); $typeHandler->getType('string')->willReturn(new BaseNode()); $base = new BaseNode(); $base->setTypeHandler($typeHandler->reveal()); $child = $base->add('foobar', 'string', ['transformer' => new DateTimeTransformer()]); $this->assertEquals(new \DateTime('2014-01-01 00:00:00'), $child->getValue('foobar', '2014-01-01 00:00:00')); }
public function bind(array $input) { $this->define(); try { $this->output = $this->root->getValue('root', $this->root->walk($input)); } catch (RequiredFieldException $exception) { $this->errors[] = 'Missing required field: ' . $exception->getField(); } catch (\RuntimeException $exception) { $this->errors[] = $exception->getMessage(); } }