laravel-enum icon indicating copy to clipboard operation
laravel-enum copied to clipboard

App breaks when using DB translation loaders in tests

Open LucaPuddu opened this issue 3 years ago • 0 comments

Whenever a translation is used in the service provider, an app that loads translations from the DB (e.g. using spatie/laravel-translation-loader) will break, cause the database hasn't been migrated yet when the app is bootstrapped.

Steps:

  1. install both packages without migrating the db
  2. add a /test route:
    Route::get('test', function () {
        return 'hello';
    });
    
  3. go to /test
    Illuminate\Database\QueryException
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.language_lines' doesn't exist (SQL: select * from `language_lines` where `group` = *) 
    

Normally this is not an issue, because you should have the language_lines table in the db, but it totally breaks testing.

LucaPuddu avatar Feb 08 '22 01:02 LucaPuddu