Exemplo n.º 1
0
 public function testBindWithEmptyDataCreatesObjectIfInitiallyBoundWithObject()
 {
     $form = $this->factory->create('form', null, array('data' => new Author(), 'required' => false));
     $form->add($this->factory->createNamed('field', 'firstName'));
     $form->add($this->factory->createNamed('field', 'lastName'));
     $form->setData(null);
     // partially empty, still an object is created
     $form->bind(array('firstName' => 'Bernhard', 'lastName' => ''));
     $author = new Author();
     $author->firstName = 'Bernhard';
     $author->setLastName('');
     $this->assertEquals($author, $form->getData());
 }
Exemplo n.º 2
0
 public function testGetValueReadsIssers()
 {
     $path = new PropertyPath('australian');
     $object = new Author();
     $object->setAustralian(false);
     $this->assertSame(false, $path->getValue($object));
 }
Exemplo n.º 3
0
 public function testUpdateFromObjectReadsIssers()
 {
     $object = new Author();
     $object->setAustralian(false);
     $field = new TestField('australian');
     $field->updateFromObject($object);
     $this->assertSame(false, $field->getData());
 }