You are here

public function PushBackControllerTest::testUseCallbackUrlDoNotOverrideHost in TMGMT Translator Smartling 8.2

Use callback url. Do not override host.

File

src/Tests/PushBackControllerTest.php, line 147

Class

PushBackControllerTest
Push back controller tests.

Namespace

Drupal\tmgmt_smartling\Tests

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