public function ContextTest::testSilentSwitchingOn in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 tests/src/Functional/ContextTest.php \Drupal\Tests\tmgmt_smartling\Functional\ContextTest::testSilentSwitchingOn()
Test context uploading with turned on "Silent switching mode" feature.
File
- tests/
src/ Functional/ ContextTest.php, line 167
Class
- ContextTest
- Context tests.
Namespace
Drupal\Tests\tmgmt_smartling\FunctionalCode
public function testSilentSwitchingOn() {
if (!empty($this->smartlingPluginProviderSettings)) {
// Set up silent user switching mode.
$plugin_settings = $this->smartlingPluginProviderSettings;
$plugin_settings['settings[context_silent_user_switching]'] = TRUE;
$translator = $this
->setUpSmartlingProviderSettings($plugin_settings);
$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
->assertNoRaw(t('User @name has logged out.', [
'@name' => 'Anonymous',
]));
$this
->assertNoRaw(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,
]));
}
else {
$this
->fail("Smartling settings file for simpletests not found.");
}
}