public function testErrorMessageIsStringInsteadArray()
 {
     $match = new stdClass();
     $classMetadata = $this->getMock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata');
     $classMetadata->expects($this->once())->method('getIdentifierFieldNames')->will($this->returnValue(array('id')));
     $classMetadata->expects($this->once())->method('getIdentifierValues')->with($match)->will($this->returnValue(array('id' => 'identifier')));
     $objectManager = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
     $objectManager->expects($this->any())->method('getClassMetadata')->with('stdClass')->will($this->returnValue($classMetadata));
     $repository = $this->getMock('Doctrine\\Common\\Persistence\\ObjectRepository');
     $repository->expects($this->any())->method('getClassName')->will($this->returnValue('stdClass'));
     $repository->expects($this->once())->method('findOneBy')->with(array('matchKey' => 'matchValue'))->will($this->returnValue($match));
     $validator = new UniqueObject(array('object_repository' => $repository, 'object_manager' => $objectManager, 'fields' => 'matchKey', 'use_context' => true));
     $this->assertFalse($validator->isValid('matchValue', array('matchKey' => 'matchValue', 'id' => 'another identifier')));
     $messageTemplates = $validator->getMessageTemplates();
     $expectedMessage = str_replace('%value%', 'matchValue', $messageTemplates[UniqueObject::ERROR_OBJECT_NOT_UNIQUE]);
     $messages = $validator->getMessages();
     $receivedMessage = $messages[UniqueObject::ERROR_OBJECT_NOT_UNIQUE];
     $this->assertTrue($expectedMessage == $receivedMessage);
 }