public function LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 4.0.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.0.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.1.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.2.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.3.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.4.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.6.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.7.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
- 3.8.x tests/src/Unit/Remote/LingotekApiUnitTest.php \Drupal\Tests\lingotek\Unit\Remote\LingotekApiUnitTest::testCancelDocumentTargetWithoutAuthorization()
@covers ::cancelDocumentTarget
File
- tests/
src/ Unit/ Remote/ LingotekApiUnitTest.php, line 206
Class
- LingotekApiUnitTest
- @coversDefaultClass \Drupal\lingotek\Remote\LingotekApi @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\Unit\RemoteCode
public function testCancelDocumentTargetWithoutAuthorization() {
$this
->expectException('\\Drupal\\lingotek\\Exception\\LingotekApiException');
$this
->expectExceptionMessage('Failed to cancel document');
$this->client
->expects($this
->at(0))
->method('post')
->with('/api/document/fancy-document-id/translation/es_ES/cancel', [
'id' => 'fancy-document-id',
'locale' => 'es_ES',
'cancelled_reason' => 'CANCELLED_BY_AUTHOR',
'mark_invoiceable' => 'true',
])
->will($this
->throwException(new \Exception('', Response::HTTP_FORBIDDEN)));
$response = $this->lingotek_api
->cancelDocumentTarget('fancy-document-id', 'es_ES');
$this
->assertEquals($response
->getStatusCode(), Response::HTTP_FORBIDDEN);
}