You are here

public function ContextTest::testContextSendingByCron in TMGMT Translator Smartling 8.2

Test context sending by cron.

File

src/Tests/ContextTest.php, line 46

Class

ContextTest
Context tests.

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