You are here

public function SettingsFormTest::testValidationWrongParameters in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/SettingsFormTest.php \Drupal\Tests\tmgmt_smartling\Functional\SettingsFormTest::testValidationWrongParameters()

Test Smartling provider plugin form validation with wrong parameters.

File

tests/src/Functional/SettingsFormTest.php, line 15

Class

SettingsFormTest
Settings form tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function testValidationWrongParameters() {
  if (!empty($this->smartlingPluginProviderSettings)) {

    // Validation with wrong parameters.
    $settings = $this->smartlingPluginProviderSettings;
    $settings['settings[project_id]'] = $this
      ->randomString();
    $settings['settings[user_id]'] = $this
      ->randomString();
    $settings['settings[token_secret]'] = $this
      ->randomString();
    $settings['settings[key]'] = $this
      ->randomString();
    $translator = $this
      ->setUpSmartlingProviderSettings($settings);
    $supported_remote_languages = $translator
      ->getPlugin()
      ->getSupportedRemoteLanguages($translator);
    $this
      ->assertEqual(0, count($supported_remote_languages));
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}