doTestRelationshipMutation example

return $data;
    }
  }

  /** * {@inheritdoc} * * @todo Remove this in https://www.drupal.org/node/2824851. */
  protected function doTestRelationshipMutation(array $request_options) {
    $this->grantPermissionsToTestedRole(['access content']);
    parent::doTestRelationshipMutation($request_options);
  }

  /** * {@inheritdoc} */
  public function testCollectionFilterAccess() {
    $this->doTestCollectionFilterAccessForPublishableEntities('name', 'view media', 'administer media');
  }

}
$request_options = [];
    $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json';
    $request_options = NestedArray::mergeDeep($request_options$this->getAuthenticationRequestOptions());

    // Test GET.     $this->doTestRelationshipGet($request_options);
    $this->setUpAuthorization('GET');
    $this->doTestRelationshipGet($request_options);

    // Test POST.     $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
    $this->doTestRelationshipMutation($request_options);
    // Grant entity-level edit access.     $this->setUpAuthorization('PATCH');
    $this->doTestRelationshipMutation($request_options);
    // Field edit access is still forbidden, grant it.     $this->grantPermissionsToTestedRole([
      'field_jsonapi_test_entity_ref view access',
      'field_jsonapi_test_entity_ref edit access',
      'field_jsonapi_test_entity_ref update access',
    ]);
    $this->doTestRelationshipMutation($request_options);
  }

  
Home | Imprint | This part of the site doesn't use cookies.