function AjaxCommandsUnitTest::testAlertCommand

Tests that AlertCommand objects can be constructed and rendered.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Ajax/AjaxCommandsUnitTest.php, line 77
Definition of Drupal\system\Tests\Ajax\AjaxCommandsUnitTest.

Class

AjaxCommandsUnitTest
Tests for all AJAX Commands.

Namespace

Drupal\system\Tests\Ajax

Code

function testAlertCommand() {
  $command = new AlertCommand('Set condition 1 throughout the ship!');
  $expected = array(
    'command' => 'alert',
    'text' => 'Set condition 1 throughout the ship!',
  );
  $this
    ->assertEqual($command
    ->render(), $expected, 'AlertCommand::render() returns a proper array.');
}