You are here

public function PushBackControllerTest::testUseCallbackUrlDoNotOverrideHost in TMGMT Translator Smartling 8.4

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

Use callback url. Do not override host.

File

tests/src/Functional/PushBackControllerTest.php, line 137

Class

PushBackControllerTest
Push back controller tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function testUseCallbackUrlDoNotOverrideHost() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    global $base_url;
    $providerSettings = $this->smartlingPluginProviderSettings;
    $providerSettings['settings[callback_url_use]'] = TRUE;
    $providerSettings['settings[callback_url_host]'] = '';
    $translator = $this
      ->setUpSmartlingProviderSettings($providerSettings);
    $job = $this
      ->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
    $translatorPlugin = $job
      ->getTranslatorPlugin();
    $callbackUrl = $this
      ->invokeMethod($translatorPlugin, 'getCallbackUrl', [
      $job,
    ]);
    $this
      ->assertTrue($base_url . '/tmgmt-smartling-callback/1', $callbackUrl);
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}