public function JsonApiFunctionalMultilingualTest::testDeleteMultilingual in JSON:API 8.2
Tests deleting multilingual content.
File
- tests/
src/ Functional/ JsonApiFunctionalMultilingualTest.php, line 296
Class
- JsonApiFunctionalMultilingualTest
- Tests JSON:API multilingual support.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
public function testDeleteMultilingual() {
$this
->config('jsonapi.settings')
->set('read_only', FALSE)
->save(TRUE);
$this
->grantPermissions(Role::load(RoleInterface::ANONYMOUS_ID), [
'bypass node access',
]);
$response = $this
->request('DELETE', Url::fromUri('base:/ca/jsonapi/node/article/' . $this->nodes[0]
->uuid()), []);
$this
->assertSame(405, $response
->getStatusCode());
$document = Json::decode((string) $response
->getBody());
$this
->assertSame('Deleting a resource object translation is not yet supported. See https://www.drupal.org/docs/8/modules/jsonapi/translations.', $document['errors'][0]['detail']);
$response = $this
->request('DELETE', Url::fromUri('base:/ca-fr/jsonapi/node/article/' . $this->nodes[0]
->uuid()), []);
$this
->assertSame(405, $response
->getStatusCode());
$document = Json::decode((string) $response
->getBody());
$this
->assertSame('Deleting a resource object translation is not yet supported. See https://www.drupal.org/docs/8/modules/jsonapi/translations.', $document['errors'][0]['detail']);
$response = $this
->request('DELETE', Url::fromUri('base:/jsonapi/node/article/' . $this->nodes[0]
->uuid()), []);
$this
->assertSame(204, $response
->getStatusCode());
$this
->assertFalse(Node::load($this->nodes[0]
->id()));
}