function BundleTest::testBundleRegistrationDynamic

Tests that the DIC keeps up with module enable/disable in the same request.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Bundle/BundleTest.php, line 48
Definition of Drupal\system\Tests\Bundle\BundleTest.

Class

BundleTest
Tests bundle registration to the DIC.

Namespace

Drupal\system\Tests\Bundle

Code

function testBundleRegistrationDynamic() {

  // Disable the module and ensure the bundle's service is not registered.
  module_disable(array(
    'bundle_test',
  ));
  $this
    ->assertFalse(drupal_container()
    ->has('bundle_test_class'), 'The bundle_test_class service does not exist in the DIC.');

  // Enable the module and ensure the bundle's service is registered.
  module_enable(array(
    'bundle_test',
  ));
  $this
    ->assertTrue(drupal_container()
    ->has('bundle_test_class'), 'The bundle_test_class service exists in the DIC.');
}