You are here

protected function LingotekManagementTestTrait::assertLingotekWorkbenchLink in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  2. 4.0.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  3. 3.0.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  4. 3.1.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  5. 3.2.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  6. 3.3.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  7. 3.4.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  8. 3.5.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  9. 3.7.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()
  10. 3.8.x tests/src/Functional/LingotekManagementTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekManagementTestTrait::assertLingotekWorkbenchLink()

Asserts there is a link to the Lingotek workbench in a new tab.

Parameters

string $locale: The locale.

string $document_id: The Lingotek document ID. Optional, defaults to 'dummy-document-hash-id'.

84 calls to LingotekManagementTestTrait::assertLingotekWorkbenchLink()
ChineseBulkTranslationTest::testContentTypeTranslationUsingLinks in tests/src/Functional/ChineseBulkTranslationTest.php
Tests that a config can be translated using the links on the management page.
ChineseBulkTranslationTest::testNodeTranslationUsingLinks in tests/src/Functional/ChineseBulkTranslationTest.php
Tests that a node can be translated using the links on the management page.
ChineseBulkTranslationTest::testSystemSiteTranslationUsingLinks in tests/src/Functional/ChineseBulkTranslationTest.php
Tests that a node can be translated using the links on the management page.
LingotekContentTranslationPreSaveHookTest::testNodeTranslation in tests/src/Functional/LingotekContentTranslationPreSaveHookTest.php
Tests that a node can be translated.
LingotekContentTypeBulkLocaleTranslationTest::testSystemSiteTranslationUsingLinks in tests/src/Functional/LingotekContentTypeBulkLocaleTranslationTest.php
Tests that a node can be translated using the links on the management page.

... See full list

File

tests/src/Functional/LingotekManagementTestTrait.php, line 261

Class

LingotekManagementTestTrait
Trait with Lingotek management form helpers.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function assertLingotekWorkbenchLink($locale, $document_id = 'dummy-document-hash-id', $text = NULL) {
  $basepath = \Drupal::request()
    ->getBasePath();
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/workbench/' . $document_id . '/' . $locale);
  $workbench_link = $this
    ->xpath("//a[@href='{$basepath}/admin/lingotek/workbench/{$document_id}/{$locale}' and @target='_blank']");
  if ($text !== NULL) {
    $workbench_link = $this
      ->xpath("//a[@href='{$basepath}/admin/lingotek/workbench/{$document_id}/{$locale}' and @target='_blank' and text()='{$text}']");
  }
  $this
    ->assertEqual(count($workbench_link), 1, 'Workbench links open in a new tab.');
}