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

Mocking via a fake impl of GenericConnection #113

Open
tomc1998 opened this issue Aug 14, 2017 · 2 comments
Open

Mocking via a fake impl of GenericConnection #113

tomc1998 opened this issue Aug 14, 2017 · 2 comments

Comments

@tomc1998
Copy link

Hey!

I'm trying to create a 'mock connection', which will let me pass a function a fake mysql connection and instead of reading an actual database, will just return fake data and record the SQL queries. This is to make unit tests run faster (i.e. not have to have actual database access)

However, the GenericConnection trait requires that I return Stmt, QueryResult objects etc which cannot be created without a real connection.

I was just wondering your thoughts on a better API for this kind of thing. Could we expose a new() method on Stmt, do you think? Or, have the GenericConnection methods return trait objects / enums with a fake value?

I wasn't sure of the best way of going about this, as I don't know the internals of the library all too well. A penny for your thoughts?

Thanks!

@blackbeam
Copy link
Owner

Hi.
I've just generalized GenericConnection more in 60feec2, but i'm not sure it'll really work for you.
Could you please try it yourself (this change is in mocking branch)?

@westy92
Copy link

westy92 commented Jul 8, 2023

What's the latest on this? It looks like GenericConnection has been removed.

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

3 participants