You are here

public function DrupalSetMessageTest::testDrupalSetMessage in Zircon Profile 8

Same name in this branch
  1. 8 core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageTest.php \Drupal\KernelTests\Core\Common\DrupalSetMessageTest::testDrupalSetMessage()
  2. 8 core/modules/system/src/Tests/Bootstrap/DrupalSetMessageTest.php \Drupal\system\Tests\Bootstrap\DrupalSetMessageTest::testDrupalSetMessage()
Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageTest.php \Drupal\KernelTests\Core\Common\DrupalSetMessageTest::testDrupalSetMessage()

The basic functionality of drupal_set_message().

File

core/tests/Drupal/KernelTests/Core/Common/DrupalSetMessageTest.php, line 21
Contains \Drupal\KernelTests\Core\Common\DrupalSetMessageTest.

Class

DrupalSetMessageTest
@covers ::drupal_set_message @group PHPUnit

Namespace

Drupal\KernelTests\Core\Common

Code

public function testDrupalSetMessage() {
  drupal_set_message(t('A message: @foo', [
    '@foo' => 'bar',
  ]));
  $messages = drupal_get_messages();
  $this
    ->assertInstanceOf('Drupal\\Core\\Render\\Markup', $messages['status'][0]);
  $this
    ->assertEquals('A message: bar', (string) $messages['status'][0]);
}