示例#1
0
 public function testUpdateFromObjectPassesObjectThroughIfPropertyPathIsEmpty()
 {
     $object = new Author();
     $object->firstName = 'Bernhard';
     $field = new TestField('firstName', array('property_path' => null));
     $field->updateFromObject($object);
     $this->assertEquals($object, $field->getData());
 }
示例#2
0
 public function testSubmittedValuesAreNotTrimmedBeforeTransformingIfDisabled()
 {
     // The value is passed to the value transformer
     $transformer = $this->createMockTransformer();
     $transformer->expects($this->once())->method('reverseTransform')->with($this->identicalTo(' a '))->will($this->returnValue('reverse[ a ]'));
     $transformer->expects($this->exactly(2))->method('transform')->will($this->returnValue(' a '));
     $field = new TestField('title', array('trim' => false, 'value_transformer' => $transformer));
     $field->submit(' a ');
     $this->assertEquals(' a ', $field->getDisplayedData());
     $this->assertEquals('reverse[ a ]', $field->getData());
 }
示例#3
0
 public function testUpdateFromObjectReadsIssers()
 {
     $object = new Author();
     $object->setAustralian(false);
     $field = new TestField('australian');
     $field->updateFromObject($object);
     $this->assertSame(false, $field->getData());
 }