You are here

public function SettingsFormTest::testValidationWrongParameters in TMGMT Translator Smartling 8.2

Test Smartling provider plugin form validation with wrong parameters.

File

src/Tests/SettingsFormTest.php, line 15

Class

SettingsFormTest
Settings form tests.

Namespace

Drupal\tmgmt_smartling\Tests

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.");
  }
}