Skip to content
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

Merged
merged 2 commits into from
Nov 18, 2016
Merged

[DX] Add details about invalid Connection passed at creation of EntityManager. #6136

merged 2 commits into from
Nov 18, 2016

Conversation

SpacePossum
Copy link
Contributor

No description provided.

@@ -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));
Copy link
Member

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"'

@Ocramius Ocramius added this to the 2.6.0 milestone Nov 17, 2016
@Ocramius Ocramius self-assigned this Nov 17, 2016
@@ -204,4 +207,15 @@ public function transactionalCallback($em)
$this->assertSame($this->_em, $em);
return 'callback';
}

/**
* @expectedException \InvalidArgumentException
Copy link
Member

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

Copy link
Contributor Author

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))

Copy link
Member

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 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 updated

@Ocramius
Copy link
Member

@SpacePossum 👍 merged, thanks a lot!

@Ocramius Ocramius merged commit e37041a into doctrine:master Nov 18, 2016
Ocramius added a commit that referenced this pull request Nov 18, 2016
@SpacePossum
Copy link
Contributor Author

thanks @Ocramius 👍 :)

@SpacePossum SpacePossum deleted the master_EntityManager_exception_details_on_connection_fail branch November 18, 2016 08:25
yvoyer pushed a commit to yvoyer/doctrine2 that referenced this pull request Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants