You are here

private function AddThisFunctionalityTestCase::addThisSystemSettingsShouldBeAbleToBeSaved in AddThis 7.4

1 call to AddThisFunctionalityTestCase::addThisSystemSettingsShouldBeAbleToBeSaved()
AddThisFunctionalityTestCase::testFunctionality in tests/AddThisFunctionalityTestCase.test

File

tests/AddThisFunctionalityTestCase.test, line 83
Tests for the AddThis-module.

Class

AddThisFunctionalityTestCase
@file Tests for the AddThis-module.

Code

private function addThisSystemSettingsShouldBeAbleToBeSaved() {
  $edit_basic = array();

  // Basic settings
  $profileId = AddThisTestHelper::generateRandomLowercaseString();
  $edit_basic[AddThis::PROFILE_ID_KEY] = $profileId;
  $uiDelay = 400;
  $edit_basic[AddThis::UI_DELAY_KEY] = $uiDelay;
  $uiHeaderBackgroundColor = '#000000';
  $edit_basic[AddThis::UI_HEADER_BACKGROUND_COLOR_KEY] = $uiHeaderBackgroundColor;
  $uiHeaderColor = '#ffffff';
  $edit_basic[AddThis::UI_HEADER_COLOR_KEY] = $uiHeaderColor;
  $coBrand = AddThisTestHelper::generateRandomLowercaseString();
  $edit_basic[AddThis::CO_BRAND_KEY] = $coBrand;
  $edit_basic[AddThis::COMPLIANT_508_KEY] = TRUE;
  $edit_basic[AddThis::CLICKBACK_TRACKING_ENABLED_KEY] = TRUE;

  // Can only be tested with Google Analytics module installed.

  //$edit_basic[AddThis::GOOGLE_ANALYTICS_TRACKING_ENABLED_KEY] = TRUE;

  //$edit_basic[AddThis::GOOGLE_ANALYTICS_SOCIAL_TRACKING_ENABLED_KEY] = TRUE;
  $edit_basic[AddThis::ADDRESSBOOK_ENABLED_KEY] = TRUE;
  $edit_basic[AddThis::CLICK_TO_OPEN_COMPACT_MENU_ENABLED_KEY] = TRUE;
  $edit_basic[AddThis::OPEN_WINDOWS_ENABLED_KEY] = TRUE;
  $edit_basic[AddThis::STANDARD_CSS_ENABLED_KEY] = TRUE;
  $serviceName = '2linkme';
  $edit_basic["addthis_enabled_services[{$serviceName}]"] = $serviceName;
  $this
    ->drupalPost('admin/config/user-interface/addthis', $edit_basic, t('Save configuration'));
  $this
    ->assertText(t('The configuration options have been saved.'), 'AddThis system settings should be able to be saved.');
  $this
    ->addThisProfileIdShouldBeAbleToBeSaved($profileId);
  $this
    ->addThisUiDelayShouldBeAbleToBeSaved($uiDelay);
  $this
    ->addThisUiHeaderBackgroundColorShouldBeAbleToBeSaved($uiHeaderBackgroundColor);
  $this
    ->addThisUiHeaderColorShouldBeAbleToBeSaved($uiHeaderColor);
  $this
    ->addThisCoBrandShouldBeAbleToBeSaved($coBrand);
  $this
    ->addThis508CompliantSettingShouldBeAbleToBeSaved();
  $this
    ->addThisClickbackTrackingEnabledSettingShouldBeAbleToBeSaved();

  // Can only be tested with Google Analytics module installed.

  //$this->addThisGoogleAnalyticsTrackingEnabledSettingShouldBeAbleToBeSaved();

  //$this->addThisGoogleAnalyticsSocialTrackingEnabledSettingShouldBeAbleToBeSaved();
  $this
    ->addThisClickToOpenCompactMenuEnabledSettingShouldBeAbleToBeSaved();
  $this
    ->addThisOpenWindowsEnabledSettingShouldBeAbleToBeSaved();
  $this
    ->addThisStandardCssEnabledSettingShouldBeAbleToBeSaved();
  $this
    ->addThisEnabledServicesShouldBeAbleToBeSaved($serviceName);

  // Advanced configuration
  $edit_basic = array();
  $servicesCssUrl = AddThis::DEFAULT_SERVICES_CSS_URL;
  $edit_basic[AddThis::SERVICES_CSS_URL_KEY] = $servicesCssUrl;
  $servicesJsonUrl = AddThis::DEFAULT_SERVICES_JSON_URL;
  $edit_basic[AddThis::SERVICES_JSON_URL_KEY] = $servicesJsonUrl;
  $widgetJsUrl = AddThis::DEFAULT_WIDGET_JS_URL;
  $edit_basic[AddThis::WIDGET_JS_URL_KEY] = $widgetJsUrl;
  $edit_basic[AddThis::CUSTOM_CONFIGURATION_CODE_ENABLED_KEY] = TRUE;
  $customConfigurationCode = AddThisTestHelper::generateRandomLowercaseString();
  $edit_basic[AddThis::CUSTOM_CONFIGURATION_CODE_KEY] = $customConfigurationCode;
  $this
    ->drupalPost('admin/config/user-interface/addthis/advanced', $edit_basic, t('Save configuration'));
  $this
    ->addThisServicesCssUrlShouldBeAbleToBeSaved($servicesCssUrl);
  $this
    ->addThisServicesJsonUrlShouldBeAbleToBeSaved($servicesJsonUrl);
  $this
    ->addThisWidgetJsUrlShouldBeAbleToBeSaved($widgetJsUrl);
  $this
    ->addThisCustomConfigurationCodeEnabledSettingShouldBeAbleToBeSaved();
}