You are here

trait LingotekInterfaceTranslationTestTrait in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait
  2. 3.2.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait
  3. 3.3.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait
  4. 3.4.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait
  5. 3.6.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait
  6. 3.7.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait
  7. 3.8.x tests/src/Functional/LingotekInterfaceTranslationTestTrait.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTestTrait

Trait with Lingotek interface translation test assertion helpers.

Hierarchy

File

tests/src/Functional/LingotekInterfaceTranslationTestTrait.php, line 8

Namespace

Drupal\Tests\lingotek\Functional
View source
trait LingotekInterfaceTranslationTestTrait {
  protected function assertLingotekInterfaceTranslationUploadLink($component) {
    $basepath = \Drupal::request()
      ->getBasePath();
    $href = $basepath . '/admin/lingotek/interface-translation/upload?component=' . $component;
    if ($destination = $this
      ->getDestination()) {
      $href .= $destination;
    }
    $this
      ->assertSession()
      ->linkByHrefExists($href, 0);
  }
  protected function assertLingotekInterfaceTranslationCheckSourceStatusLink($component) {
    $basepath = \Drupal::request()
      ->getBasePath();
    $href = $basepath . '/admin/lingotek/interface-translation/check-upload?component=' . $component;
    if ($destination = $this
      ->getDestination()) {
      $href .= $destination;
    }
    $this
      ->assertSession()
      ->linkByHrefExists($href, 0);
  }
  protected function assertLingotekInterfaceTranslationRequestTranslationLink($component, $locale) {
    $basepath = \Drupal::request()
      ->getBasePath();
    $href = $basepath . '/admin/lingotek/interface-translation/request-translation?component=' . $component . '&locale=' . $locale;
    if ($destination = $this
      ->getDestination()) {
      $href .= $destination;
    }
    $this
      ->assertSession()
      ->linkByHrefExists($href, 0);
  }
  protected function assertNoLingotekInterfaceTranslationRequestTranslationLink($component, $locale) {
    $basepath = \Drupal::request()
      ->getBasePath();
    $href = $basepath . '/admin/lingotek/interface-translation/request-translation?component=' . $component . '&locale=' . $locale;
    if ($destination = $this
      ->getDestination()) {
      $href .= $destination;
    }
    $this
      ->assertSession()
      ->linkByHrefNotExists($href, 0);
  }
  protected function assertLingotekInterfaceTranslationCheckTargetStatusLink($component, $locale) {
    $basepath = \Drupal::request()
      ->getBasePath();
    $href = $basepath . '/admin/lingotek/interface-translation/check-translation?component=' . $component . '&locale=' . $locale;
    if ($destination = $this
      ->getDestination()) {
      $href .= $destination;
    }
    $this
      ->assertSession()
      ->linkByHrefExists($href, 0);
  }
  protected function assertLingotekInterfaceTranslationDownloadLink($component, $locale) {
    $basepath = \Drupal::request()
      ->getBasePath();
    $href = $basepath . '/admin/lingotek/interface-translation/download-translation?component=' . $component . '&locale=' . $locale;
    if ($destination = $this
      ->getDestination()) {
      $href .= $destination;
    }
    $this
      ->assertSession()
      ->linkByHrefExists($href, 0);
  }
  protected function getDestination($entity_type_id = 'node', $prefix = NULL) {
    $basepath = \Drupal::request()
      ->getBasePath();
    return '&destination=' . $basepath . $this
      ->getInterfaceTranslationFormUrl($prefix);
  }
  protected function getInterfaceTranslationFormUrl($prefix = NULL) {
    return ($prefix === NULL ? '' : '/' . $prefix) . '/admin/lingotek/manage/interface-translation';
  }

}

Members