You are here

public function SmartlingTest::testSilentSwitchingOff in TMGMT Translator Smartling 8

Test context uploading with turned off "Silent switching mode" feature.

File

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

Class

SmartlingTest
Basic tests for the Smartling translator.

Namespace

Drupal\tmgmt_smartling\Tests

Code

public function testSilentSwitchingOff() {
  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(t('User @name has logged out.', [
      '@name' => 'Anonymous',
    ]));
    $this
      ->assertRaw(t('User @name has logged in.', [
      '@name' => $this->smartlingPluginProviderSettings['settings[contextUsername]'],
    ]));
    $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.");
  }
}