getExpectedGetRelationshipResponse example


  protected function doTestRelationshipGet(array $request_options) {
    $relationship_field_names = $this->getRelationshipFieldNames($this->entity);
    // If there are no relationship fields, we can't test relationship routes.     if (empty($relationship_field_names)) {
      return;
    }

    // Test GET.     $related_responses = $this->getRelationshipResponses($relationship_field_names$request_options);
    foreach ($relationship_field_names as $relationship_field_name) {
      $expected_resource_response = $this->getExpectedGetRelationshipResponse($relationship_field_name);
      $expected_document = $expected_resource_response->getResponseData();
      $expected_cacheability = $expected_resource_response->getCacheableMetadata();
      $actual_response = $related_responses[$relationship_field_name];
      $this->assertResourceResponse(
        $expected_resource_response->getStatusCode(),
        $expected_document,
        $actual_response,
        $expected_cacheability->getCacheTags(),
        $expected_cacheability->getCacheContexts(),
        FALSE,
        $expected_resource_response->isSuccessful() ? 'MISS' : FALSE
      );
Home | Imprint | This part of the site doesn't use cookies.