fromJson($json)->getServerRequestValidator(); $psrRequest = (new ServerRequest('post', 'http://localhost:8000/api/v1/products')) ->withHeader('Content-Type', 'application/json') ->withQueryParams([ 'fields' => ['array1'], ]); $this->expectException(InvalidQueryArgs::class); $validator->validate($psrRequest); } }