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

Redirect subclass tests #23

Open
wants to merge 5 commits into
base: pdo_subclassing
Choose a base branch
from

Conversation

tontonsb
Copy link

@tontonsb tontonsb commented Sep 7, 2023

This is an attempt to resolve Danack/pdo_shenanigans#6, turned out to be really cumbersome, at least for my skillset :)

I modified the factory in pdo_test.inc so it could also create a subclass when required to. So we can use test redirection to run the same testsuite with the old PDO as well as with PDO::connect.

I had to modify run-tests.php to allow skipping double redirects instead of borking, otherwise I could not redirect to a suite that contains another redirect (and the pdo_pgsql suite already has a redirect to base pdo suite).

I've included two redirects at the moment:

  • subclass_through_pgsql_suite.phpt is running the pdo_pgsql tests using an instance created by PDO::connect (subclass specific tests are excluded as they are running without the redirect already)
  • subclass_through_pdo_suite.phpt is running the pdo tests using an instance created by PDO::connect (eight tests are excluded because they either invoke PDO directly without the factory or expect the exact classname PDO in the output)

We can potentially add similar redirects to all the other drivers, but you should decide whether this direction is anything we'd like to take at all.

I understand that the initial request was to only share a couple of tests, but all my attempts at moving them to a subdirectory or even a sibling directory failed, because the tests strongly rely on directory structure — they need the test files and redirects to have similar sibling files and the same path depth.

@tontonsb tontonsb changed the title redirect-subclass-tests Redirect subclass tests Sep 7, 2023
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.

1 participant