class ServiceProviderWebTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php \Drupal\Tests\system\Functional\ServiceProvider\ServiceProviderWebTest
- 10 core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php \Drupal\Tests\system\Functional\ServiceProvider\ServiceProviderWebTest
- 8.9.x core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php \Drupal\Tests\system\Functional\ServiceProvider\ServiceProviderWebTest
Tests service provider registration to the DIC.
@group ServiceProvider
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Functional\ServiceProvider\ServiceProviderWebTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ServiceProviderWebTest
File
-
core/
modules/ system/ tests/ src/ Functional/ ServiceProvider/ ServiceProviderWebTest.php, line 12
Namespace
Drupal\Tests\system\Functional\ServiceProviderView source
class ServiceProviderWebTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'file',
'service_provider_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests that module service providers get registered to the DIC.
*
* Also tests that services provided by module service providers get
* registered to the DIC.
*/
public function testServiceProviderRegistrationIntegration() {
$this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC');
// The event subscriber method in the test class calls
// \Drupal\Core\Messenger\MessengerInterface::addStatus() with a message
// saying it has fired. This will fire on every page request so it should
// show up on the front page.
$this->drupalGet('');
$this->assertSession()
->pageTextContains('The service_provider_test event subscriber fired!');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.