You are here

protected function LingotekNodeBulkViewsTranslationTest::assertSourceStatus in Lingotek Translation 3.4.x

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

Overwritten, so untracked can be as not shown. Assert that a content source has the given status.

Parameters

string $language: The target language.

string $status: The status.

Overrides LingotekTestBase::assertSourceStatus

File

tests/src/Functional/Views/LingotekNodeBulkViewsTranslationTest.php, line 64

Class

LingotekNodeBulkViewsTranslationTest
Tests translating a node using the bulk management view.

Namespace

Drupal\Tests\lingotek\Functional\Views

Code

protected function assertSourceStatus($language, $status) {
  if ($status === Lingotek::STATUS_UNTRACKED) {
    $status_target = $this
      ->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "')  and ./a[contains(text(), '" . strtoupper($language) . "')]]");

    // If not found, maybe it didn't have a link.
    if (count($status_target) === 1) {
      $this
        ->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
    }
    else {
      $status_target = $this
        ->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "')  and contains(text(), '" . strtoupper($language) . "')]");
      if (count($status_target) === 1) {
        $this
          ->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
      }
      else {
        $status_target = $this
          ->xpath("//span[contains(@class,'language-icon')]");
        $this
          ->assertEqual(count($status_target), 0, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
      }
    }
  }
  else {
    $status_target = $this
      ->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "')  and ./a[contains(text(), '" . strtoupper($language) . "')]]");

    // If not found, maybe it didn't have a link.
    if (count($status_target) === 1) {
      $this
        ->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
    }
    else {
      $status_target = $this
        ->xpath("//span[contains(@class,'language-icon') and contains(@class,'source-" . strtolower($status) . "')  and contains(text(), '" . strtoupper($language) . "')]");
      $this
        ->assertEqual(count($status_target), 1, 'The source ' . strtoupper($language) . ' has been marked with status ' . strtolower($status) . '.');
    }
  }
}