public function testOptionsCanBeSetSingle() { $proxy = $this->getMock('DoctrineModule\\Form\\Element\\Proxy'); $proxy->expects($this->once())->method('setOptions')->with(array('is_method' => true)); $this->setProxyViaReflection($proxy); $this->element->setOption('is_method', true); }
/** * {@inheritDoc} * * @return ObjectRadio */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $entityManager = $container->get('Doctrine\\ORM\\EntityManager'); $element = new ObjectRadio(); $element->getProxy()->setObjectManager($entityManager); return $element; }
/** * {@inheritDoc} */ public function createService(ServiceLocatorInterface $pluginManager) { $services = $pluginManager->getServiceLocator(); $entityManager = $services->get('Doctrine\\ORM\\EntityManager'); $element = new ObjectRadio(); $element->getProxy()->setObjectManager($entityManager); return $element; }
public function testGetValueOptionsDoesntInvokeProxyIfOptionsNotEmpty() { $options = array('foo' => 'bar'); $proxy = $this->getMock('DoctrineModule\\Form\\Element\\Proxy'); $proxy->expects($this->once())->method('getValueOptions')->will($this->returnValue($options)); $this->setProxyViaReflection($proxy); $this->assertEquals($options, $this->element->getValueOptions()); $this->assertEquals($options, $this->element->getValueOptions()); }
/** * {@inheritDoc} */ public function setValue($value) { return parent::setValue($this->getValueOption($value)); }
public function __construct($name = null, $options = []) { parent::__construct($name, $options); }