In my application I have tests that use Sqlite and seeding to cover my functionality. So my phpunit env value is set to:
<env name="DB_DEFAULT" value="sqlite" />
However, I'd also like a set of tests that look at my current data. So within a small set of tests I'd like to connect to my MySQL connection.
I presumed I could just connect using the following:
$pdo = DB::connection('mysql')->getPdo();
However, the tests can only connect if I specify "sqlite", the name of my sqlite connection.
The testing is not based on a Model, so I don't want to have a solution built into the Model file, I'd like to switch database inside the test if possible.
How do I configure a small number of tests to use a different database connection, the existing MySQL connection?
Aucun commentaire:
Enregistrer un commentaire