public function LingotekUnitTest::testCancelDocument in Lingotek Translation 3.8.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 4.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.1.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.2.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.3.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.4.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.5.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.6.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
- 3.7.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocument()
@covers ::cancelDocument
File
- tests/
src/ Unit/ LingotekUnitTest.php, line 1203
Class
- LingotekUnitTest
- @coversDefaultClass \Drupal\lingotek\Lingotek @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\UnitCode
public function testCancelDocument() {
$response = $this
->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
$response
->expects($this
->at(0))
->method('getStatusCode')
->willReturn(Response::HTTP_NO_CONTENT);
// Test returning an error.
$response
->expects($this
->at(1))
->method('getStatusCode')
->willReturn(Response::HTTP_INTERNAL_SERVER_ERROR);
$response
->expects($this
->at(2))
->method('getStatusCode')
->willReturn(Response::HTTP_NOT_FOUND);
$this->api
->expects($this
->any())
->method('cancelDocument')
->with('my_doc_id')
->will($this
->returnValue($response));
$this
->assertTrue($this->lingotek
->cancelDocument('my_doc_id'));
$this
->assertFalse($this->lingotek
->cancelDocument('my_doc_id'));
$this
->assertFalse($this->lingotek
->cancelDocument('my_doc_id'));
}