You are here

public function LingotekApiUnitTest::testDeleteDocument in Lingotek Translation 8.2

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

@covers ::deleteDocument

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Unit\Remote

Code

public function testDeleteDocument() {
  $response = $this
    ->getMockBuilder(ResponseInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $response
    ->expects($this
    ->any())
    ->method('getStatusCode')
    ->willReturn(Response::HTTP_ACCEPTED);
  $this->client
    ->expects($this
    ->at(0))
    ->method('delete')
    ->with('/api/document/fancy-document-id')
    ->will($this
    ->returnValue($response));
  $response = $this->lingotek_api
    ->deleteDocument('fancy-document-id');
  $this
    ->assertEquals($response
    ->getStatusCode(), Response::HTTP_ACCEPTED);
}