BundleTest.php 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php

/**
 * @file
 * Definition of Drupal\system\Tests\Bundle\BundleTest.
 */

namespace Drupal\system\Tests\Bundle;

use Drupal\simpletest\WebTestBase;

/**
 * Test bundle registration to the DIC.
 */
class BundleTest extends WebTestBase {
16 17 18 19 20 21 22 23

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('bundle_test');

24 25 26 27 28 29 30 31 32 33 34 35
  public static function getInfo() {
    return array(
      'name' => 'Bundle Registration',
      'description' => 'Tests bundle registration to the DIC.',
      'group' => 'Bundle',
    );
  }

  /**
   * Test that services provided by module bundles get registered to the DIC.
   */
  function testBundleRegistration() {
36
    $this->assertTrue(drupal_container()->has('bundle_test_class'), 'The bundle_test_class service has been registered to the DIC');
37 38 39
    // The event subscriber method in the test class calls drupal_set_message with
    // a message saying it has fired. This will fire on every page request so it
    // should show up on the front page.
40
    $this->drupalGet('');
41
    $this->assertText(t('The bundle_test event subscriber fired!'), 'The bundle_test event subscriber fired');
42 43
  }
}