You are here

public function LingotekFake::cancelDocument in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 8.2 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  2. 4.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  3. 3.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  4. 3.1.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  5. 3.3.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  6. 3.4.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  7. 3.5.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  8. 3.6.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  9. 3.7.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()
  10. 3.8.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::cancelDocument()

Cancels the document with this document id from the Lingotek service.

Parameters

string $doc_id: The document id in Lingotek.

Return value

bool TRUE if the document was successfully cancelled. FALSE if not.

Overrides LingotekInterface::cancelDocument

File

tests/modules/lingotek_test/src/LingotekFake.php, line 398

Class

LingotekFake

Namespace

Drupal\lingotek_test

Code

public function cancelDocument($doc_id) {
  if (\Drupal::state()
    ->get('lingotek.must_error_in_cancel', FALSE)) {
    throw new LingotekApiException('Error was forced.');
  }
  $cancelled_docs = \Drupal::state()
    ->get('lingotek.cancelled_docs', []);
  $cancelled_docs[] = $doc_id;
  \Drupal::state()
    ->set('lingotek.cancelled_docs', $cancelled_docs);
  return TRUE;
}