You are here

function AJAXCommandsTestCase::testAJAXRender in SimpleTest 7

Test ajax_command_settings().

File

tests/ajax.test, line 69

Class

AJAXCommandsTestCase
Tests AJAX framework commands.

Code

function testAJAXRender() {
  $commands = array();
  $commands[] = ajax_command_settings(array(
    'foo' => 42,
  ));
  $result = $this
    ->drupalGetAJAX('ajax-test/render', array(
    'commands' => $commands,
  ));

  // Verify that JavaScript settings are contained (always first).
  $this
    ->assertIdentical($result[0]['command'], 'settings', t('drupal_add_js() settings are contained first.'));

  // Verify that the custom setting is contained.
  $this
    ->assertEqual($result[1]['settings']['foo'], 42, t('Custom setting is output.'));
}