public function EntityResourceTest::testDeleteRelationshipInternal in JSON:API 8
@covers ::deleteRelationship
File
- tests/
src/ Kernel/ Controller/ EntityResourceTest.php, line 838
Class
- EntityResourceTest
- @coversDefaultClass \Drupal\jsonapi\Controller\EntityResource @group jsonapi @group legacy
Namespace
Drupal\Tests\jsonapi\Kernel\ControllerCode
public function testDeleteRelationshipInternal() {
$internal_resource_type = new ResourceType('node', 'article', NULL, TRUE);
$resource = $this
->buildEntityResource('node', 'article', [
'field_relationships' => [
$internal_resource_type,
],
]);
Role::load(Role::ANONYMOUS_ID)
->grantPermission('edit any article content')
->save();
$field_type_manager = $this->container
->get('plugin.manager.field.field_type');
$list = $field_type_manager
->createFieldItemList($this->node, 'field_relationships');
$this
->setExpectedException(NotFoundHttpException::class);
$resource
->deleteRelationship($this->node, 'field_relationships', $list, new Request());
}