3 namespace Drupal\Tests\system\Functional\ServiceProvider;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests service provider registration to the DIC.
10 * @group ServiceProvider
12 class ServiceProviderWebTest extends BrowserTestBase {
19 public static $modules = ['file', 'service_provider_test'];
22 * Tests that module service providers get registered to the DIC.
24 * Also tests that services provided by module service providers get
25 * registered to the DIC.
27 public function testServiceProviderRegistrationIntegration() {
28 $this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC');
29 // The event subscriber method in the test class calls drupal_set_message()
30 // with a message saying it has fired. This will fire on every page request
31 // so it should show up on the front page.
33 $this->assertText(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired');