73d6910087dfcf4824fa5de0eb1da376d8f5ddb7
[yaffs-website] / web / core / modules / system / tests / src / Functional / ServiceProvider / ServiceProviderWebTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\ServiceProvider;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests service provider registration to the DIC.
9  *
10  * @group ServiceProvider
11  */
12 class ServiceProviderWebTest extends BrowserTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['file', 'service_provider_test'];
20
21   /**
22    * Tests that module service providers get registered to the DIC.
23    *
24    * Also tests that services provided by module service providers get
25    * registered to the DIC.
26    */
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.
32     $this->drupalGet('');
33     $this->assertText(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired');
34   }
35
36 }