Skip to content

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

Merged
merged 3 commits into from
Jul 31, 2023
Merged

Conversation

orlitzky
Copy link
Contributor

This is basically a copy/paste of the mysqli and pgsql approaches. Only a few editorial decisions were made:

  1. I have declined to include skipifconnectfailure.inc within the pre-existing skipif.inc. The check in skipif.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 if skipif.inc was renamed to something like skipifwrongdbtype.inc.
  2. To avoid an extra case, I've set $dbase (from details.inc) to null if it is unset. As a result, two empty() checks in ext/oci8/tests/password.phpt and ext/oci8/tests/password_2.phpt have to be changed to is_null().

orlitzky added 2 commits July 29, 2023 08:09
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
@orlitzky
Copy link
Contributor Author

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 ";
Copy link
Contributor

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"

@cjbj
Copy link
Contributor

cjbj commented Jul 31, 2023

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.
@orlitzky
Copy link
Contributor Author

No problem, thanks for reviewing it. I've updated that bit of wording.

@Girgias Girgias merged commit 605c60c into php:master Jul 31, 2023
jorgsowa pushed a commit to jorgsowa/php-src that referenced this pull request Aug 16, 2023
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.
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.

3 participants