public function LingotekUnitTest::testUpdateDocumentGone in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 4.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.0.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.1.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.2.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.3.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.4.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.5.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.7.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
- 3.8.x tests/src/Unit/LingotekUnitTest.php \Drupal\Tests\lingotek\Unit\LingotekUnitTest::testUpdateDocumentGone()
@covers ::updateDocument
File
- tests/
src/ Unit/ LingotekUnitTest.php, line 1649
Class
- LingotekUnitTest
- @coversDefaultClass \Drupal\lingotek\Lingotek @group lingotek @preserveGlobalState disabled
Namespace
Drupal\Tests\lingotek\UnitCode
public function testUpdateDocumentGone() {
$response = $this
->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
$this->lingotekFilterManager
->expects($this
->any())
->method('getFilterId')
->willReturn('4f91482b-5aa1-4a4a-a43f-712af7b39625');
$this->lingotekFilterManager
->expects($this
->any())
->method('getSubfilterId')
->willReturn('0e79f34d-f27b-4a0c-880e-cd9181a5d265');
$response
->expects($this
->any())
->method('getStatusCode')
->willReturn(Response::HTTP_GONE);
$response
->expects($this
->any())
->method('getBody')
->willReturn(json_encode([
'messages' => [
"Document my_doc_id has been archived.",
],
]));
$this->api
->expects($this
->at(0))
->method('patchDocument')
->with('my_doc_id', [
'content' => '{"content":"My test content","_lingotek_metadata":{"_entity_id":1}}',
'format' => 'JSON',
'fprm_subfilter_id' => '0e79f34d-f27b-4a0c-880e-cd9181a5d265',
'fprm_id' => '4f91482b-5aa1-4a4a-a43f-712af7b39625',
'external_application_id' => 'e39e24c7-6c69-4126-946d-cf8fbff38ef0',
'content_type' => 'node',
])
->will($this
->returnValue($response));
$data = [
'content' => 'My test content',
'_lingotek_metadata' => [
'_entity_id' => 1,
'_intelligence' => [
'content_type' => 'node',
],
],
];
$this
->expectException(LingotekDocumentArchivedException::class);
$this
->expectExceptionMessage('Document my_doc_id has been archived.');
$this->lingotek
->updateDocument('my_doc_id', $data);
}