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

[Tests] Support running ORM tests with any DBAL backend #2696

Open
mbabker opened this issue Sep 7, 2023 · 2 comments
Open

[Tests] Support running ORM tests with any DBAL backend #2696

mbabker opened this issue Sep 7, 2023 · 2 comments

Comments

@mbabker
Copy link
Contributor

mbabker commented Sep 7, 2023

Branching off from the conversation in #2659

The Gedmo\Tests\Tool\BaseTestCaseORM and Gedmo\Tests\Tool\BaseTestCaseOM classes have a hardcoded configuration to create a DBAL connection with an in-memory SQLite database. While that's going to be good enough the overwhelming majority of the time, there can be cases where the behavior across database backends changes in some way (again, going back to the linked issue, how PostgreSQL users specifically have an issue that isn't easily discovered through the current test setup).

The Gedmo\Tests\Tool\BaseTestCaseMongoODM and Gedmo\Tests\Tool\BaseTestCaseOM classes use an env var that can be configured through the PHPUnit config file to pass to the MongoDB\Client constructor. Maybe the ORM test case can do something similar by supporting an env var with a DSN, which when configured is used to create the DBAL connection, and falling back to the current hardcoded config when it isn't set. I mention DSN specifically instead of something like what the DBAL's own test suite does with separate parameters because it'd probably be easier to just use the DBAL's DSN parser than try to manually build the configuration. Yes, I realize that the DSN parser only exists as of DBAL 3.6, but I'd also suggest that in the overwhelming majority of cases, you'd want to run the tests against either the current release or a dev branch and not on a composer update --prefer-lowest build with legacy DBAL versions (or the now EOL'd 2.x branch).

Copy link

github-actions bot commented Mar 5, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Mar 5, 2024
@mbabker
Copy link
Contributor Author

mbabker commented Mar 5, 2024

Still relevant, just the lowest of priorities 😉

@github-actions github-actions bot removed the Stale label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant