You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I want to thank you for the great testing tool!
I have one question regarding testing the api and most specifically the laravel example.
I saw that it uses the sqlite database by default. And when running dredd tests with hooks it migrates the database and everything is okey. But what about if I want to use mysql/mariadb for my application, and use only sqlite for dredd testing(I use in memory database for phpunit tests)
I understood that I needed to choose either migrating the database from scratch before tests or just use transactions. But as Its stated in #34 its better to use the first approach.
So my question is the following. How can I change the database when running dredd tests?
So just to be clear the tl; dr of #34 is that you can't use transactions with anything out of the box. You would need some type of connection proxy that would multiplex database connections onto a single connection.
This doesn't seem like an issue with Dredd or the php hooks but it seems like your default database settings use mysql and not sqlite. You need to provide a way that would let you decide which database is the default at runtime. Depending on how you setup your application you could probably do it a few ways, but what about setting an environment variable that will force the api to use sqlite? You will need to inject that environment variable on the process running Laravel.
Since this isn't an issue with the dredd hooks from what I can tell I'm going to close this. But let me know if that helps.
First of all, I want to thank you for the great testing tool!
I have one question regarding testing the api and most specifically the laravel example.
I saw that it uses the sqlite database by default. And when running dredd tests with hooks it migrates the database and everything is okey. But what about if I want to use mysql/mariadb for my application, and use only sqlite for dredd testing(I use in memory database for phpunit tests)
I understood that I needed to choose either migrating the database from scratch before tests or just use transactions. But as Its stated in #34 its better to use the first approach.
So my question is the following. How can I change the database when running dredd tests?
This is how my hooks file look like but it when running the tests it uses the mysql instead of sqlite? var_dump function prints sqlite by the way.
I would really appreciate any help figuring this out. Writing API specification and testing it sounds like a lot of fun!
Thank you in advance!
The text was updated successfully, but these errors were encountered: