diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index ec16e37fb1db..9628748fc6fe 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -1102,6 +1102,17 @@ public function getLoadedProviders() return $this->loadedProviders; } + /** + * Determine if the given service provider is loaded. + * + * @param string $provider + * @return bool + */ + public function providerIsLoaded(string $provider) + { + return isset($this->loadedProviders[$provider]); + } + /** * Get the application's deferred services. * @@ -1292,26 +1303,4 @@ public function getNamespace() throw new RuntimeException('Unable to detect application namespace.'); } - - /** - * Determine if service provider is loaded. - * - * @param string $provider - * @return bool - */ - public function isProviderLoaded(string $provider): bool - { - return isset($this->loadedProviders[$provider]); - } - - /** - * Determine if service provider is not loaded. - * - * @param string $provider - * @return bool - */ - public function isProviderNotLoaded(string $provider): bool - { - return ! $this->isProviderLoaded($provider); - } } diff --git a/tests/Foundation/FoundationApplicationTest.php b/tests/Foundation/FoundationApplicationTest.php index 906a41f271e6..17b8b3447dd1 100755 --- a/tests/Foundation/FoundationApplicationTest.php +++ b/tests/Foundation/FoundationApplicationTest.php @@ -95,20 +95,8 @@ public function testServiceProvidersCouldBeLoaded() $app = new Application; $app->register($provider); - $this->assertTrue($app->isProviderLoaded($class)); - $this->assertFalse($app->isProviderLoaded(ApplicationBasicServiceProviderStub::class)); - } - - public function testServiceProvidersCouldBeNotLoaded() - { - $provider = m::mock(ServiceProvider::class); - $class = get_class($provider); - $provider->shouldReceive('register')->once(); - $app = new Application; - $app->register($provider); - - $this->assertTrue($app->isProviderNotLoaded(ApplicationBasicServiceProviderStub::class)); - $this->assertFalse($app->isProviderNotLoaded($class)); + $this->assertTrue($app->providerIsLoaded($class)); + $this->assertFalse($app->providerIsLoaded(ApplicationBasicServiceProviderStub::class)); } public function testDeferredServicesMarkedAsBound()