You are here

class LegacyDrupal7Test in Service Container 7.2

Same name in this branch
  1. 7.2 tests/src/Legacy/LegacyDrupal7Test.php \Drupal\Tests\service_container\Legacy\LegacyDrupal7Test
  2. 7.2 lib/Drupal/service_container/Tests/LegacyDrupal7Test.php \Drupal\service_container\Tests\LegacyDrupal7Test
Same name and namespace in other branches
  1. 7 lib/Drupal/service_container/Tests/LegacyDrupal7Test.php \Drupal\service_container\Tests\LegacyDrupal7Test

Hierarchy

Expanded class hierarchy of LegacyDrupal7Test

1 string reference to 'LegacyDrupal7Test'
LegacyDrupal7Test::getInfo in lib/Drupal/service_container/Tests/LegacyDrupal7Test.php

File

lib/Drupal/service_container/Tests/LegacyDrupal7Test.php, line 12
Contains \Drupal\service_container\Tests\LegacyDrupal7Test.

Namespace

Drupal\service_container\Tests
View source
class LegacyDrupal7Test extends ServiceContainerIntegrationTestBase {

  /**
   * {@inheritdoc}
   */
  public static function getInfo() {
    return array(
      'name' => 'LegacyDrupal7Test',
      'description' => 'Tests the legacy Drupal 7 integration service',
      'group' => 'service_container',
    );
  }
  public function testLegacyDrupal7() {

    /** @var \Drupal\service_container\Legacy\Drupal7 $drupal7_service */
    $drupal7_service = $this->container
      ->get('drupal7');
    $this
      ->assertTrue($drupal7_service instanceof Drupal7);
    $random_message = $this
      ->randomString();
    $drupal7_service
      ->drupal_set_message($random_message, 'warning');
    $messages = drupal_get_messages();
    $this
      ->assertTrue(in_array($random_message, $messages['warning']));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LegacyDrupal7Test::getInfo public static function
LegacyDrupal7Test::testLegacyDrupal7 public function
ServiceContainerIntegrationTestBase::$container protected property The dependency injection container usable in the test.
ServiceContainerIntegrationTestBase::$profile protected property The profile to install as a basis for testing. 1
ServiceContainerIntegrationTestBase::setUp protected function 5