getExpectedGetRelationshipDocument example

$response = $this->request('POST', $url$request_options);
      $this->assertResourceResponse(204, NULL, $response);

      // Test POST: success, relationship already exists, no arity.       $response = $this->request('POST', $url$request_options);
      $this->assertResourceResponse(204, NULL, $response);

      // Test POST: success, relationship already exists, new arity.       $request_options[RequestOptions::BODY] = Json::encode(['data' => [$target_identifier + ['meta' => ['arity' => 1]]]]);
      $response = $this->request('POST', $url$request_options);
      $resource->set($relationship_field_name[$target_resource$target_resource]);
      $expected_document = $this->getExpectedGetRelationshipDocument($relationship_field_name$resource);
      $expected_document['data'][0] += ['meta' => ['arity' => 0]];
      $expected_document['data'][1] += ['meta' => ['arity' => 1]];
      $this->assertResourceResponse(200, $expected_document$response);

      // Test PATCH: success, new value is the same as given value.       $request_options[RequestOptions::BODY] = Json::encode([
        'data' => [
          $target_identifier + ['meta' => ['arity' => 0]],
          $target_identifier + ['meta' => ['arity' => 1]],
        ],
      ]);
      
Home | Imprint | This part of the site doesn't use cookies.