public function testCreate() { $doctrine = $this->createMock('Symfony\\Bridge\\Doctrine\\RegistryInterface'); $transformerClass = 'Pim\\Bundle\\UIBundle\\Form\\Transformer\\AjaxEntityTransformer'; $options = ['class' => 'class']; $doctrine->expects($this->once())->method('getRepository')->with($this->equalTo('class'))->will($this->returnValue($this->createMock('Pim\\Bundle\\UIBundle\\Entity\\Repository\\OptionRepositoryInterface'))); $factory = new AjaxEntityTransformerFactory($doctrine, $transformerClass); $result = $factory->create($options); $this->assertInstanceOf($transformerClass, $result); }
/** * Returns the form type's transformer * * @param array $options * * @return \Symfony\Component\Form\DataTransformerInterface */ protected function getTransformer(array $options) { return $this->transformerFactory->create($this->getTransformerOptions($options)); }