1
votes

I have added a View::share to my application service provider:

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('features', Feature::all());
    }
}

but when I run my tests I get

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

if find all the features and share them with the views via a controller the test works. I just want to do it centrally as it is used to construct a menu that is on every page

I am sure the migrations etc are working, so do I need to add a trait or something to my test case?

1

1 Answers

0
votes

Hard to tell without seeing your test case. I'd guess that the RefreshDatabase trait is missing