-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Skip oci8 tests when no database is available #11820
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
Most oci8 tests fail out-of-the-box because a typical host won't have an Oracle database instance available. Other database drivers like mysqli and pgsql address this problem with an include file, inserted into SKIPIF, that skips the test if no connection at all can be made. This commits adds such a file (skipifconnectfailure.inc) for oci8, and adds the corresponding SKIPIF to any tests that connect to a database. Closes phpGH-11804
I don't have an Oracle instance to test the "success" case against but it looks like the CI does, so that's nice. |
oci_close($c); | ||
} | ||
else { | ||
$msg = "skip Failed to connect to Oracle instance "; |
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.
Minor comment: Say "Oracle Database instance"
This can be merged as, but I would have ideally preferred to see it included in the skipif.inc file to make that file have all the generic skip test logic - it already includes connect.inc. However, let's merge this PR and move on. Thanks for submitting it!!! |
Change "Oracle instance" to "Oracle Database instance" in an error message.
No problem, thanks for reviewing it. I've updated that bit of wording. |
Most oci8 tests fail out-of-the-box because a typical host won't have an Oracle database instance available. Other database drivers like mysqli and pgsql address this problem with an include file, inserted into SKIPIF, that skips the test if no connection at all can be made. This commits adds such a file (skipifconnectfailure.inc) for oci8, and adds the corresponding SKIPIF to any tests that connect to a database. Closes phpGH-11804 * ext/oci8/tests/lob_aliases.phpt: drop unnecessary SKIPIF.
This is basically a copy/paste of the mysqli and pgsql approaches. Only a few editorial decisions were made:
skipifconnectfailure.inc
within the pre-existingskipif.inc
. The check inskipif.inc
is for one specific condition (the type of the database) and is not universal; keeping them separate results in us having one logical "skip" check per include file. This comes at the expense of a few extra lines, but I think the end result is cleaner, and would be especially nice ifskipif.inc
was renamed to something likeskipifwrongdbtype.inc
.$dbase
(fromdetails.inc
) tonull
if it is unset. As a result, twoempty()
checks inext/oci8/tests/password.phpt
andext/oci8/tests/password_2.phpt
have to be changed tois_null()
.