Unit Tests

Export the schema

After configuring the package, run this command to export all of the database schemas:

scripts/artisan.sh schema:dump-all

Unlike the built-in schema:dump command which only dumps the primary database, this dumps each database to a separate file in database/schema/.

Update the tests

Instead of the default RefreshDatabase trait, use RefreshAllDatabases:

use Alberon\LaravelMultipleDatabases\Testing\RefreshAllDatabases;

class ExampleTest extends TestCase
{
    use RefreshAllDatabases;

    // ...
}

This will load all of the schemas into the databases configured into .env.testing, instead of just the primary one.

Note: There is currently no way to specify a subset of databases to load/refresh.