Skip to content

Improve JSON assertion in Symfony Test #57280

@hantsy

Description

@hantsy

Description

Currently the Symfony web function tests focus on traditional web pages, today many backend application/services only provide Restful APIs, the Request/Response should improve the JSON encoding and parsing.

Check JSON path doc: https://goessner.net/articles/JsonPath/

Example

$client->request(request => request->get("/posts/{id}", postId ) ->accept(...) ->contentType(...) ->headers(headers => headers->put()) ->jsonBody(...) )
$response->jsonPath("$.size()") $response->jsonPath("$.foo.bar") $response->jsonPath("$foo['bar']")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions