So my company has been pushing an effort to do more unit testing, which I think is good. However, our product is fairly database heavy, and some purists part of the team to set the standards (that I am on) are insistent on "no mysql database EVER in a unit test"
While normally this would be fine if starting off from this point, we have a ton of old code that you're very rarely going to not use even a piece of during a unit test. Doing some research, some people suggest using an sqlite in memory database to handle working in a situation like this, where you may have methods that need to take a piece of data from the db, and then do some complex logic on that data.
Essentially I have it working if the database isn't specified in the query, however if it is it will not work, because i can't find a way to alias the memory database. Is it possible? Essentially I want to be able to run a query like "SELECT * FROM config.users WHERE id='2'" on a memory database
Aucun commentaire:
Enregistrer un commentaire