-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Re-add common PDO tests to Firebird test suite #4112
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
Conversation
These have been inadvertently dropped when changing the test suite to not require ext/interbase anymore, so we add them back. We also change the required environment variable names to match the usual PDO names. Particularly, we replace `PDO_FIREBIRD_TEST_HOSTNAME` and `_DATABASE` with the more flexible `PDO_FIREBIRD_TEST_DSN`.
define('PDO_FIREBIRD_TEST_PASSWORD', getenv('PDO_FIREBIRD_TEST_PASSWORD') ?: 'phpfi'); | ||
define('PDO_FIREBIRD_TEST_HOSTNAME', getenv('PDO_FIREBIRD_TEST_HOSTNAME') ?: 'localhost'); | ||
define('PDO_FIREBIRD_TEST_DATABASE', getenv('PDO_FIREBIRD_TEST_DATABASE') ?: ''); | ||
define('PDO_FIREBIRD_TEST_USER', getenv('PDO_FIREBIRD_TEST_USER') ?: 'SYSDBA'); |
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.
How about using the following code snippets:
......
getenv('PDO_FIREBIRD_TEST_USER') ?? 'SYSDBA';
......
It's the PHP 7 syntax.
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.
@peter279k we can’t as getenv() returns false, not null
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.
Ok, using the ?:
syntax to detect condition if it is false.
$dbh = new PDO(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS) or die; |
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.
If the DB connection is failed, I think we need to output some notification message via die
function.
It can make use have note that the DB connection status message.
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.
PDO already yields an error message, die simply prevents further execution
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.
Ok. It's fine to use die
function.
Ah I wasn't aware of this magic I removed with PDO, in that case lets go for it. I think its a more elegant solution with the DSN environment variable too |
These have been inadvertently dropped when changing the test suite to
not require ext/interbase anymore, so we add them back.
We also change the required environment variable names to match the
usual PDO names. Particularly, we replace
PDO_FIREBIRD_TEST_HOSTNAME
and
_DATABASE
with the more flexiblePDO_FIREBIRD_TEST_DSN
.