Exemple #1
0
 /**
  * Expose method for testing purposes
  */
 public function setValueTransformer(ValueTransformerInterface $valueTransformer)
 {
     parent::setValueTransformer($valueTransformer);
 }
Exemple #2
0
 public function testBindUpdatesTransformedDataFromAllFields()
 {
     $originalAuthor = new Author();
     $transformedAuthor = new Author();
     // the authors should differ to make sure the test works
     $transformedAuthor->firstName = 'Foo';
     $group = new FieldGroup('author');
     $transformer = $this->createMockTransformer();
     $transformer->expects($this->once())->method('transform')->with($this->equalTo($originalAuthor))->will($this->returnValue($transformedAuthor));
     $group->setValueTransformer($transformer);
     $group->setData($originalAuthor);
     $field = $this->createMockField('firstName');
     $field->expects($this->once())->method('updateObject')->with($this->equalTo($transformedAuthor));
     $group->add($field);
     $field = $this->createMockField('lastName');
     $field->expects($this->once())->method('updateObject')->with($this->equalTo($transformedAuthor));
     $group->add($field);
     $group->bind(array());
     // irrelevant
 }