function JsonApiFunctionalMultilingualTest::testDeleteMultilingual
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalMultilingualTest::testDeleteMultilingual()
- 10 core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalMultilingualTest::testDeleteMultilingual()
- 11.x core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalMultilingualTest::testDeleteMultilingual()
Tests deleting multilingual content.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ JsonApiFunctionalMultilingualTest.php, line 304
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->assertNull(Node::load($this->nodes[0]
->id()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.