Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 20, 2020
1 parent b49803e commit b87233f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 36 deletions.
33 changes: 11 additions & 22 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
16 changes: 2 additions & 14 deletions tests/Foundation/FoundationApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b87233f

Please sign in to comment.