-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
PdoDriver: check for misconfigured PDO connections resource (target 3.3.x and 4.0.x) #294
PdoDriver: check for misconfigured PDO connections resource (target 3.3.x and 4.0.x) #294
Conversation
838b540
to
303d46f
Compare
1ac208e
to
9840c31
Compare
I do not know where to add tests for this. I dot see any PdoDriver unit test. Should I make one? |
If you want, create a test :) |
One is never sure enough. |
Any elegant way how to create PDO connection from |
require __DIR__ . '/bootstrap.php'; | ||
|
||
if($config['driver'] !== 'pdo') { | ||
\Tester\Environment::skip('Only relevant for PDO driver.'); |
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.
Wanted to use something like:
/**
* @dataProvider ../databases.ini *, pdo
*/
However it looks like tester does not support anything like that.
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.
Maybe use workaround like != foo, pdo
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.
Sounds good!
|
||
// PDO error mode: warning | ||
Assert::exception(function() use ($config) { | ||
($pdoConnection = new PDO($config['dsn']))->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
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.
It should be PDO::ERRMODE_WARNING
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
Great, thanks! |
…rom PDO connection using Dibi internal factories)
->getProperty('connection'); | ||
$connectionProperty->setAccessible(TRUE); | ||
$pdo = $connectionProperty->getValue($dibiDriver); | ||
\assert($pdo instanceof PDO); |
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.
I have tried to rethink a little creation process of PDO connection. As it is quite complex I have delegated it back to \Dibi\Connection
.
… unexpected exceptions in ODBC-PDO driver.
see #292