You are here

public function SmartlingTest::testContextSendingByCron in TMGMT Translator Smartling 8

Test context sending by cron.

File

src/Tests/SmartlingTest.php, line 295
Contains \Drupal\tmgmt_smartling\Tests\SmartlingTest.

Class

SmartlingTest
Basic tests for the Smartling translator.

Namespace

Drupal\tmgmt_smartling\Tests

Code

public function testContextSendingByCron() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $translator = $this
      ->setUpSmartlingProviderSettings($this->smartlingPluginProviderSettings);
    $job = $this
      ->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
    $fileName = $job
      ->getTranslatorPlugin()
      ->getFileName($job);
    $this
      ->cronRun();
    $this
      ->drupalGet('admin/reports/dblog');
    $this
      ->assertRaw('We are about to switch user');
    $this
      ->assertRaw('User was successfully switched');
    $this
      ->assertRaw(t('Context upload for file @filename completed successfully.', [
      '@filename' => $fileName,
    ]));
    $this
      ->deleteTestFile($fileName);
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}