/** * @param TransformerInterface $transformer * @return $this */ public function transform(TransformerInterface $transformer) { $this->transformers->addTransformer($transformer); $this->definition->setTransformer($this->transformers); return $this; }
public function testSettleDenormalize() { $object = $this->getDocument(); $transformer = $this->getTransformerMock(); $transformer->expects($this->once())->method('denormalize')->with('baz')->will($this->returnValue('foo')); $accessor = $this->getAccessorMock(); $accessor->expects($this->once())->method('setValue')->with($object, 'path', 'foo'); $definition = new Definition(); $definition->setPropertyAccessor($accessor); $definition->setPropertyPath('path'); $definition->setTransformer($transformer); $definition->settle($object, 'baz'); }