1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Update message.

This commit is contained in:
SpacePossum 2016-11-18 08:06:11 +01:00
parent f9a605f6ca
commit e37041aa94
2 changed files with 10 additions and 5 deletions

View File

@ -860,7 +860,13 @@ use Doctrine\Common\Util\ClassUtils;
}
if ( ! $connection instanceof Connection) {
throw new \InvalidArgumentException(sprintf('Invalid argument for connection "%s".', is_object($connection) ? get_class($connection) : gettype($connection) . '#' . $connection));
throw new \InvalidArgumentException(
sprintf(
'Invalid $connection argument of type %s given%s.',
is_object($connection) ? get_class($connection) : gettype($connection),
is_object($connection) ? '' : ': "' . $connection . '"'
)
);
}
if ($eventManager !== null && $connection->getEventManager() !== $eventManager) {

View File

@ -208,12 +208,11 @@ class EntityManagerTest extends OrmTestCase
return 'callback';
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessageRegExp /^Invalid argument for connection \"integer#1\".$/
*/
public function testCreateInvalidConnection()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessageRegExp('/^Invalid \$connection argument of type integer given: \"1\".$/');
$config = new Configuration();
$config->setMetadataDriverImpl($this->createMock(MappingDriver::class));
EntityManager::create(1, $config);