Lumen testing environment with MongoDB

In a service provider I set the Mongo database name I am using within the application like this: $this->app->bind(‘MongoDB’, function() { $client = new MongoClient(); return $client->selectDB(‘myproductiondatabase’); }); When running phpunit to run my tests I want to use a different database that gets recreated on every test. What ive done so far is: $db = $this->app->environment(‘production’) ? ‘myproductiondatabase’ :…
Read more