public function LingotekUnitTest::testCancelDocumentTarget in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 4.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.1.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.2.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.3.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.4.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.6.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.7.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
- 3.8.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testCancelDocumentTarget()
@covers ::cancelDocumentTarget
File
- tests/
src/ Unit/ LingotekUnitTest.php, line 1229
Class
- LingotekUnitTest
- @coversDefaultClass \Drupal\lingotek\Lingotek @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\UnitCode
public function testCancelDocumentTarget() {
$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('cancelDocumentTarget')
->with('my_doc_id', 'es_ES')
->will($this
->returnValue($response));
$this
->assertTrue($this->lingotek
->cancelDocumentTarget('my_doc_id', 'es_ES'));
$this
->assertFalse($this->lingotek
->cancelDocumentTarget('my_doc_id', 'es_ES'));
$this
->assertFalse($this->lingotek
->cancelDocumentTarget('my_doc_id', 'es_ES'));
}