]> Dogcows Code - chaz/graphql-client/blob - t/lib/MockTransport.pm
Release GraphQL-Client 0.605
[chaz/graphql-client] / t / lib / MockTransport.pm
1 package MockTransport;
2 # ABSTRACT: A backend for testing HTTP::AnyUA
3
4 use warnings;
5 use strict;
6
7 sub new { bless {}, shift }
8
9 =method response
10
11 $response = $backend->response;
12 $response = $backend->response($response);
13
14 Get and set the response hashref or L<Future> that this backend will always respond with.
15
16 =cut
17
18 sub response { @_ == 2 ? $_[0]->{response} = pop : $_[0]->{response} }
19
20 =method requests
21
22 @requests = $backend->requests;
23
24 Get the requests the backend has handled so far.
25
26 =cut
27
28 sub requests { @{$_[0]->{requests} || []} }
29
30 sub execute {
31 my $self = shift;
32
33 push @{$self->{requests} ||= []}, [@_];
34
35 return $self->response;
36 }
37
38 1;
This page took 0.032241 seconds and 4 git commands to generate.