You are here

public function TMGMTUiContinuousTest::testAddContinuousLink in Translation Management Tool 8

Tests access to add continuous job link.

File

tests/src/Functional/TMGMTUiContinuousTest.php, line 161

Class

TMGMTUiContinuousTest
Verifies continuous functionality of the user interface

Namespace

Drupal\Tests\tmgmt\Functional

Code

public function testAddContinuousLink() {
  $this
    ->drupalLogin($this
    ->createUser([
    'create translation jobs',
  ]));
  $this
    ->drupalGet('admin/tmgmt/jobs');
  $this
    ->assertResponse(200);
  $this
    ->assertNoText('Add continuous job', 'Link is not displayed if user doesn\'t have permission.');
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('admin/tmgmt/jobs');
  $this
    ->assertText('Add continuous job', 'User has access to link with the right permission.');
  \Drupal::service('module_installer')
    ->uninstall([
    'tmgmt_test',
  ]);
  $this
    ->drupalGet('admin/tmgmt/jobs');
  $this
    ->assertNoText('Add continuous job', 'Link is not showing if there is no continuous translator.');

  // The 'Add continuous job' is currently not showing up without clearing the
  // cache after we add a continuous translator.
  // @see https://www.drupal.org/node/2685445
  // \Drupal::service('module_installer')->install(['tmgmt_test']);
  // $this->drupalGet('admin/tmgmt/jobs');
  // $this->assertText('Add continuous job', 'Link is showing if there is a continuous translator.');
}