public function testMapFormsToDataIgnoresDisabled()
 {
     $car = new \stdClass();
     $engine = new \stdClass();
     $propertyPath = $this->getPropertyPath('engine');
     $this->propertyAccessor->expects($this->never())->method('setValue');
     $config = new FormConfigBuilder('name', '\\stdClass', $this->dispatcher);
     $config->setByReference(true);
     $config->setPropertyPath($propertyPath);
     $config->setData($engine);
     $config->setDisabled(true);
     $form = $this->getForm($config);
     $this->mapper->mapFormsToData(array($form), $car);
 }
Esempio n. 2
0
 public function testMapFormsToDataSkipsVirtualForms()
 {
     $car = new \stdClass();
     $engine = new \stdClass();
     $parentPath = $this->getPropertyPath('name');
     $childPath = $this->getPropertyPath('engine');
     $parentPath->expects($this->never())->method('getValue');
     $parentPath->expects($this->never())->method('setValue');
     $childPath->expects($this->once())->method('setValue')->with($car, $engine);
     $config = new FormConfig('name', '\\stdClass', $this->dispatcher);
     $config->setPropertyPath($parentPath);
     $config->setVirtual(true);
     $form = $this->getForm($config);
     $config = new FormConfig('engine', '\\stdClass', $this->dispatcher);
     $config->setByReference(true);
     $config->setPropertyPath($childPath);
     $config->setData($engine);
     $child = $this->getForm($config);
     $form->add($child);
     $this->mapper->mapFormsToData(array($form), $car);
 }
Esempio n. 3
0
 public function testMapFormsToDataSkipsVirtualForms()
 {
     $car = new \stdClass();
     $engine = new \stdClass();
     $parentPath = $this->getPropertyPath('name');
     $childPath = $this->getPropertyPath('engine');
     // getValue() and setValue() must never be invoked for $parentPath
     $this->propertyAccessor->expects($this->once())->method('getValue')->with($car, $childPath);
     $this->propertyAccessor->expects($this->once())->method('setValue')->with($car, $childPath, $engine);
     $config = new FormConfigBuilder('name', '\\stdClass', $this->dispatcher);
     $config->setPropertyPath($parentPath);
     $config->setVirtual(true);
     $config->setCompound(true);
     $config->setDataMapper($this->getDataMapper());
     $form = $this->getForm($config);
     $config = new FormConfigBuilder('engine', '\\stdClass', $this->dispatcher);
     $config->setByReference(true);
     $config->setPropertyPath($childPath);
     $config->setData($engine);
     $child = $this->getForm($config);
     $form->add($child);
     $this->mapper->mapFormsToData(array($form), $car);
 }