You are here

public function LoggingTest::testViewActionEventLogging in TMGMT Translator Smartling 8.2

Test request translation in a batch logging.

File

src/Tests/LoggingTest.php, line 115

Class

LoggingTest
Logging tests.

Namespace

Drupal\tmgmt_smartling\Tests

Code

public function testViewActionEventLogging() {
  if (!empty($this->smartlingPluginProviderSettings)) {

    // Create a job. It is needed for test.
    $translator = $this
      ->setUpSmartlingProviderSettings($this->smartlingPluginProviderSettings);
    $this
      ->requestTranslationForNode($this->testNodeId, 'de', $translator);

    // Clean log messages after job submission.
    $this
      ->drupalPostForm('/admin/reports/dblog/confirm', [], t('Confirm'));
    $this
      ->drupalPostForm('/admin/tmgmt/jobs', [
      'tmgmt_job_bulk_form[0]' => '',
      'action' => 'tmgmt_extension_suit_upload_job_action_id',
    ], t('Apply to selected items'));
    $this
      ->drupalPostForm(NULL, [], t('Send for Translation'));
    $this
      ->drupalGet('/admin/reports/dblog');

    // File triggered/queued.
    $this
      ->assertNoRaw('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
      ->assertRaw('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.');
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}