Testing the Repository
Learn how to perform integration testing for loading, saving, and updating a product.
We'll cover the following...
We'll cover the following...
Global operations
Now that our parts are in place, we can write an integration test for our repository implementation. First, we need to do some things globally for the test scope.
Here, we clean our database, run the migration, and after we have executed all the tests, close the repository.
Remember: not cleaning the database between tests might be an even more thorough test.
loadProduct
Let’s move on to the test for loading a single product.
We create one Repository instance for all our tests here. The downside is that if one test ...