public function setUp() { $capsule = new Capsule(); $capsule->addConnection(['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '']); $capsule->setAsGlobal(); $capsule->bootEloquent(); TranslatableConfig::currentLocaleGetter(function () { return 'en'; }); TranslatableConfig::fallbackLocaleGetter(function () { return 'en'; }); require_once __DIR__ . '/stubs/Post.php'; }
/** * Register the service provider. * * @return void */ public function register() { TranslatableConfig::cacheGetter(function ($table) { return $this->app['cache']->get('translatable.' . $table); }); TranslatableConfig::cacheSetter(function ($table, $fields) { return $this->app['cache']->forever('translatable.' . $table, $fields); }); TranslatableConfig::currentLocaleGetter(function () { return $this->app->getLocale(); }); TranslatableConfig::fallbackLocaleGetter(function () { return method_exists($this->app, 'getFallbackLocale') ? $this->app->getFallbackLocale() : config('app.fallback_locale'); }); }