You are here

public function LingotekApiUnitTest::testDeleteDocumentThatDoesntExist in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testDeleteDocumentThatDoesntExist()

@covers ::deleteDocument

File

tests/src/Unit/Remote/LingotekApiUnitTest.php, line 138

Class

LingotekApiUnitTest
@coversDefaultClass \Drupal\lingotek\Remote\LingotekApi @group lingotek @preserveGlobalState disabled

Namespace

Drupal\Tests\lingotek\Unit\Remote

Code

public function testDeleteDocumentThatDoesntExist() {
  $this->client
    ->expects($this
    ->at(0))
    ->method('delete')
    ->with('/api/document/fancy-document-id')
    ->will($this
    ->throwException(new \Exception('', Response::HTTP_NOT_FOUND)));
  $response = $this->lingotek_api
    ->deleteDocument('fancy-document-id');
  $this
    ->assertEquals($response
    ->getStatusCode(), Response::HTTP_NOT_FOUND);
}