function AjaxCommandsUnitTest::testSettingsCommand

Tests that SettingsCommand objects can be constructed and rendered.

File

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

Class

AjaxCommandsUnitTest
Tests for all AJAX Commands.

Namespace

Drupal\system\Tests\Ajax

Code

function testSettingsCommand() {
  $command = new SettingsCommand(array(
    'key' => 'value',
  ), TRUE);
  $expected = array(
    'command' => 'settings',
    'settings' => array(
      'key' => 'value',
    ),
    'merge' => TRUE,
  );
  $this
    ->assertEqual($command
    ->render(), $expected, 'SettingsCommand::render() returns a proper array.');
}