You are here

public function LegacyDrupal7Test::testLegacyDrupal7 in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/service_container/Tests/LegacyDrupal7Test.php \Drupal\service_container\Tests\LegacyDrupal7Test::testLegacyDrupal7()

File

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

Class

LegacyDrupal7Test

Namespace

Drupal\service_container\Tests

Code

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']));
}