You are here

protected function LingotekTestBase::assertSourceStatusStateCount in Lingotek Translation 8

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.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

1 call to LingotekTestBase::assertSourceStatusStateCount()
LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments in src/Tests/LingotekUtilitiesDisassociateAllDocumentsTest.php

File

src/Tests/LingotekTestBase.php, line 150

Class

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

Namespace

Drupal\lingotek\Tests

Code

protected function assertSourceStatusStateCount($status, $languageLabel, $count, $message = '') {
  $statusCssClass = 'source-' . strtolower($status);
  $statusCount = $this
    ->xpath("//span[contains(@class,'language-icon') and contains(@class, '{$statusCssClass}')]/a[contains(text(), '{$languageLabel}')]");
  return $this
    ->assertEqual(count($statusCount), $count, $message);
}