/**
  * @expectedException        \InvalidArgumentException
  * @expectedExceptionMessage A single selection must be passed a single value not a collection. Make sure that form option "multiple=false" is set for many-to-one relation and "multiple=true" is set for many-to-many or one-to-many relations.
  */
 public function testTransformEntityException()
 {
     $entity1 = new Foo();
     $entity1->setBar('foo');
     $entity2 = new Foo();
     $entity2->setBar('bar');
     $entity3 = new Foo();
     $entity3->setBar('baz');
     $collection = new ArrayCollection();
     $collection[] = $entity1;
     $collection[] = $entity2;
     $collection[] = $entity3;
     $transformer = new ModelToIdPropertyTransformer($this->modelManager, 'Sonata\\AdminBundle\\Tests\\Fixtures\\Entity\\Foo', 'bar', false);
     $transformer->transform($collection);
 }
 public function testGetFieldValueWithCodeOption()
 {
     $foo = new Foo();
     $foo->setBaz('Baz');
     $description = new FieldDescription();
     $description->setOption('code', 'getBaz');
     $this->assertEquals('Baz', $description->getFieldValue($foo, 'inexistantMethod'));
     $description->setOption('code', 'inexistantMethod');
     $this->setExpectedException('Sonata\\AdminBundle\\Exception\\NoValueException');
     $description->getFieldValue($foo, 'inexistantMethod');
 }