lundi 31 décembre 2018

QueryException: General error: 1 no such table: {table_name} (SQL: select * from "{table_name}")

  • Laravel Version: 5.7
  • PHP Version: 7.2
  • Database Driver: sqlite
  • Database: memory

All testing on PHPUnit was working completely fine. But when I added View::share in AppServiceProvider then all the PHPUnit tests failed.

AppServiceProvider.php

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        \View::share('categories', \App\Models\Category::all());
    }
}

Error

Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: categories (SQL: select * from "categories")

I have already used RefreshDatabase in my all test.

Please guide me, how can I fix this. Where should I call View::share in Laravel app so, all tests should pass.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2EYGuAg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire