assertAuthenticationEdgeCases example

$request_options[RequestOptions::BODY] = $parseable_invalid_request_body_3;

    // DX: 403 when entity contains field without 'edit' access.     $response = $this->request('POST', $url$request_options);
    $this->assertResourceErrorResponse(403, "Access denied on creating field 'field_rest_test'.", $response);

    $request_options[RequestOptions::BODY] = $parseable_valid_request_body;

    // Before sending a well-formed request, allow the normalization and     // authentication provider edge cases to also be tested.     $this->assertNormalizationEdgeCases('POST', $url$request_options);
    $this->assertAuthenticationEdgeCases('POST', $url$request_options);

    $request_options[RequestOptions::HEADERS]['Content-Type'] = 'text/xml';

    // DX: 415 when request body in existing but not allowed format.     $response = $this->request('POST', $url$request_options);
    $this->assertResourceErrorResponse(415, 'No route found that matches "Content-Type: text/xml"', $response);

    $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType;

    // 201 for well-formed request.     $response = $this->request('POST', $url$request_options);
    
Home | Imprint | This part of the site doesn't use cookies.