You are here

protected function LingotekTestBase::assertSourceStatusStateCount in Lingotek Translation 3.6.x

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

Asserts if there are a number of documents with a given status and language label as source.

Parameters

string $status: The status we are looking for. Use Lingotek constants.

string $languageLabel: The language label of the source.

int $count: The expected number of items.

string $message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

7 calls to LingotekTestBase::assertSourceStatusStateCount()
LingotekContentTypeBulkTranslationTest::testCheckTranslationsAction in tests/src/Functional/LingotekContentTypeBulkTranslationTest.php
Tests that all the statuses are set when using the Check Translations action.
LingotekEntityTestBulkTranslationTest::testCheckTranslationsAction in tests/src/Functional/LingotekEntityTestBulkTranslationTest.php
Tests that all the statuses are set when using the Check Translations action.
LingotekFieldBodyBulkTranslationTest::testCheckTranslationsAction in tests/src/Functional/LingotekFieldBodyBulkTranslationTest.php
Tests that all the statuses are set when using the Check Translations action.
LingotekNodeBulkTranslationTest::testCheckTranslationsAction in tests/src/Functional/LingotekNodeBulkTranslationTest.php
Tests that all the statuses are set when using the Check Translations action.
LingotekSystemSiteBulkTranslationTest::testCheckTranslationsAction in tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php
Tests that all the statuses are set when using the Check Translations action.

... See full list

File

tests/src/Functional/LingotekTestBase.php, line 242

Class

LingotekTestBase
Base class for Lingotek test. Performs authorization of the account.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function assertSourceStatusStateCount($status, $languageLabel, $count, $message = '') {
  $statusCssClass = 'source-' . strtolower($status);
  if ($status === Lingotek::STATUS_CURRENT) {

    // There is no link or anchor when the status is current.
    $statusCount = $this
      ->xpath("//span[contains(@class,'language-icon') and contains(@class, '{$statusCssClass}') and contains(text(), '{$languageLabel}')]");
  }
  else {
    $statusCount = $this
      ->xpath("//span[contains(@class,'language-icon') and contains(@class, '{$statusCssClass}')]/a[contains(text(), '{$languageLabel}')]");
  }
  $this
    ->assertEqual(count($statusCount), $count, $message);
}