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()); }
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()); }
public function testUpdateFromObjectReadsIssers() { $object = new Author(); $object->setAustralian(false); $field = new TestField('australian'); $field->updateFromObject($object); $this->assertSame(false, $field->getData()); }