You are here

public function JuiceboxConfGlobalCase::testGlobalConfig in Juicebox HTML5 Responsive Image Galleries 7.2

Test general global options.

This methods tests multiple global options at once, but these could later be broken out into different test methods if needed.

File

tests/JuiceboxConfGlobalCase.test, line 46
Test case for Juicebox global configuration options.

Class

JuiceboxConfGlobalCase
Class to define test case for Juicebox global configuration options.

Code

public function testGlobalConfig() {
  $instance = $this->instance;
  $node = $this->node;

  // Enable some optional global settings. We could set each of these easily
  // with a variable_set(), but it's probably best to test the whole UI.
  $edit = array(
    'juicebox_enable_cors' => TRUE,
    'juicebox_translate_interface' => TRUE,
    'juicebox_translate_base_languagelist' => 'Show Thumbnails|Hide Thumbnails|Expand Gallery|Close Gallery|Open Image in New Window',
  );
  $this
    ->drupalPost('admin/config/media/juicebox', $edit, t('Save configuration'));
  $this
    ->assertText(t('The configuration options have been saved'), 'Custom global options saved.');

  // Get resulting XML.
  $this
    ->drupalGet('juicebox/xml/field/node/' . $node->nid . '/' . $instance['field_name'] . '/full');

  // Check that the languagelist configuration option was both included and
  // translated in the XML.
  $this
    ->assertRaw('languagelist="Translated|Lang|List"', 'Translated languagelist value found in XML.');

  // Check the the XML now returns an 'Access-Control-Allow-Origin' header
  // for CORS support.
  $this
    ->assertEqual($this
    ->drupalGetHeader('Access-Control-Allow-Origin'), '*', 'Expected CORS header found.');
}