function ServiceProviderTest::testServiceProviderRegistration in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/ServiceProvider/ServiceProviderTest.php \Drupal\system\Tests\ServiceProvider\ServiceProviderTest::testServiceProviderRegistration()
Tests that services provided by module service providers get registered to the DIC.
File
- core/
modules/ system/ src/ Tests/ ServiceProvider/ ServiceProviderTest.php, line 29 - Contains \Drupal\system\Tests\ServiceProvider\ServiceProviderTest.
Class
- ServiceProviderTest
- Tests service provider registration to the DIC.
Namespace
Drupal\system\Tests\ServiceProviderCode
function testServiceProviderRegistration() {
$definition = $this->container
->getDefinition('file.usage');
$this
->assertTrue($definition
->getClass() == 'Drupal\\service_provider_test\\TestFileUsage', 'Class has been changed');
$this
->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service has been registered to the DIC');
}