You are here

public function PushBackControllerTest::testPushBackExistingJobWithoutLocale in TMGMT Translator Smartling 8.2

Push back existing job without locale.

File

src/Tests/PushBackControllerTest.php, line 62

Class

PushBackControllerTest
Push back controller tests.

Namespace

Drupal\tmgmt_smartling\Tests

Code

public function testPushBackExistingJobWithoutLocale() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $translator = $this
      ->setUpSmartlingProviderSettings($this->smartlingPluginProviderSettings);
    $job = $this
      ->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
    $fileName = $job
      ->getTranslatorPlugin()
      ->getFileName($job);
    $this
      ->checkGeneratedFile($fileName, $this->testNodeTitle);

    // Try to push back existing job without locale parameter.
    $this
      ->drupalGet("tmgmt-smartling-callback/{$job->id()}", [
      'query' => [
        'fileUri' => $fileName,
      ],
    ]);
    $this
      ->assertResponse(404);
    $this
      ->deleteTestFile($fileName);
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}