You are here

public function LingotekFake::deleteDocument in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 8 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::deleteDocument()

Deletes 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 deleted. FALSE if not.

Overrides LingotekInterface::deleteDocument

Deprecated

in 8.x-2.14, will be removed in 8.x-2.16. Use ::cancelDocument instead.

File

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

Class

LingotekFake

Namespace

Drupal\lingotek_test

Code

public function deleteDocument($doc_id) {
  throw new LingotekApiException('Delete shouldn\'t happen. Documents must be cancelled.');
  if (\Drupal::state()
    ->get('lingotek.must_error_in_disassociate', FALSE)) {
    throw new LingotekApiException('Error was forced.');
  }
  $deleted_docs = \Drupal::state()
    ->get('lingotek.deleted_docs', []);
  $deleted_docs[] = $doc_id;
  \Drupal::state()
    ->set('lingotek.deleted_docs', $deleted_docs);
  return TRUE;
}