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 __construct(TypeHandler $typeHandler = null) { $this->root = new BaseNode(); $this->typeHandler = $typeHandler ?? new TypeHandler(); $this->root->setTypeHandler($this->typeHandler); }