From 625cc08b814df312d37788f8a7946cab5174c2bb Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Thu, 22 Aug 2019 10:49:05 +0800 Subject: [PATCH] Tweak service container --- app/Providers/AppServiceProvider.php | 3 ++- tests/ServicesTest/OptionTest.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1acbeb30..a1e5b4e6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -21,7 +21,8 @@ class AppServiceProvider extends ServiceProvider public function register() { $this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher')); - $this->app->singleton('options', \App\Services\Option::class); + $this->app->singleton(\App\Services\Option::class); + $this->app->alias(\App\Services\Option::class, 'options'); $this->app->singleton('parsedown', \Parsedown::class); $this->app->singleton('webpack', \App\Services\Webpack::class); } diff --git a/tests/ServicesTest/OptionTest.php b/tests/ServicesTest/OptionTest.php index 6dc052f2..512aadf8 100644 --- a/tests/ServicesTest/OptionTest.php +++ b/tests/ServicesTest/OptionTest.php @@ -36,6 +36,7 @@ class OptionTest extends TestCase $mock->shouldReceive('getRequire')->with($path)->once()->andReturn(['k' => 'v']); }); + app()->forgetInstance(Option::class); $options = resolve(Option::class); $this->assertEquals('v', $options->get('k')); }