-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DX] Add details about invalid Connection passed at creation of EntityManager. #6136
[DX] Add details about invalid Connection passed at creation of EntityManager. #6136
Conversation
@@ -860,7 +860,7 @@ protected static function createConnection($connection, Configuration $config, E | |||
} | |||
|
|||
if ( ! $connection instanceof Connection) { | |||
throw new \InvalidArgumentException("Invalid argument: " . $connection); | |||
throw new \InvalidArgumentException(sprintf('Invalid argument for connection "%s".', is_object($connection) ? get_class($connection) : gettype($connection) . '#' . $connection)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #
is confusing in my opinion. The message should probably be 'Invalid $connection argument of type %s given: "%s"'
@@ -204,4 +207,15 @@ public function transactionalCallback($em) | |||
$this->assertSame($this->_em, $em); | |||
return 'callback'; | |||
} | |||
|
|||
/** | |||
* @expectedException \InvalidArgumentException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use $this->expectExceptionMessage()
and $this->expectException()
instead of the annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine by me to change, but setExpectedException
has been deprecated on PHPUnit
(for ref.: sebastianbergmann/phpunit#2074 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SpacePossum then the new API. We can bump the required PHPUnit version without any issues 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 updated
@SpacePossum 👍 merged, thanks a lot! |
thanks @Ocramius 👍 :) |
No description provided.