Skip to content

Latest commit

 

History

History
23 lines (21 loc) · 711 Bytes

route-with-consecutive-calls.md

File metadata and controls

23 lines (21 loc) · 711 Bytes

Route with consecutive calls

$builder = new ConsecutiveCallsRouteBuilder(
    Psr17FactoryDiscovery::findResponseFactory(),
    Psr17FactoryDiscovery::findStreamFactory(),
);

$route = $builder->withMethod('GET')
    ->withPath('/country')
    ->withResponse(new Response(200, [], '{"id":"+39","code":"IT","name":"Italy"}'))
    ->withStringResponse(
        content: '{"id":"+33","code":"FR","name":"France"}',
        httpStatus: 201,
        headers: ['content-type' => 'application/json']
    )
    ->withFileResponse(
            file: __DIR__ . '/fixtures/country-spain.json',
            httpStatus: 201,
            headers: ['content-type' => 'application/json']
        )
    ->build();