/**
  * @expectedException        \RuntimeException
  * @expectedExceptionMessage Callback in "to_string_callback" option doesn`t contain callable function.
  */
 public function testTransformToStringCallbackException()
 {
     $entity = new Foo();
     $entity->setBar('example');
     $entity->setBaz('bazz');
     $this->modelManager->expects($this->once())->method('getIdentifierValues')->will($this->returnValue(array(123)));
     $transformer = new ModelToIdPropertyTransformer($this->modelManager, 'Sonata\\AdminBundle\\Tests\\Fixtures\\Entity\\Foo', 'bar', false, '987654');
     $transformer->transform($entity);
 }
 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');
 }