You are here

public function LoggingTest::testRequestTranslationEventLogging in TMGMT Translator Smartling 8.2

Test request translation logging.

File

src/Tests/LoggingTest.php, line 55

Class

LoggingTest
Logging tests.

Namespace

Drupal\tmgmt_smartling\Tests

Code

public function testRequestTranslationEventLogging() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $this
      ->drupalPostForm('/admin/tmgmt/sources', [
      'items[1]' => 1,
    ], t('Request translation'));
    $this
      ->drupalPostForm(NULL, [
      'target_language' => 'de',
    ], t('Submit to provider'));
    $this
      ->drupalGet('/admin/reports/dblog');

    // File triggered/queued.
    $this
      ->assertRaw('File upload triggered (request translation). Job id: 1, file name: JobID1_en_de.xml.');
    $this
      ->assertNoRaw('File upload queued (request translation in a batch). Job id: 1, file name: JobID1_en_de.xml.');
    $this
      ->assertNoRaw('File upload triggered (view action). Job id: 1, file name: JobID1_en_de.xml.');
    $this
      ->assertNoRaw('File upload queued (track entity changes). Job id: 1, file name: JobID1_en_de.xml.');

    // File uploaded.
    $this
      ->assertRaw('File uploaded. Job id: 1, file name: JobID1_en_de.xml.');
    $this
      ->assertNoRaw('File uploaded. Job id: 2, file name: JobID2_en_fr.xml.');
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}