File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -52,4 +52,27 @@ function it_creates_an_empty_response_when_none_is_added(
52
52
53
53
$ this ->sendRequest ($ request )->shouldReturn ($ response );
54
54
}
55
+
56
+ function it_returns_the_last_response (ResponseInterface $ response )
57
+ {
58
+ $ this ->addResponse ($ response );
59
+
60
+ $ this ->getLastResponse ()->shouldReturn ($ response );
61
+ }
62
+
63
+ function it_returns_the_last_exception ()
64
+ {
65
+ $ exception = new \Exception ();
66
+ $ this ->addException ($ exception );
67
+
68
+ $ this ->getLastException ()->shouldReturn ($ exception );
69
+ }
70
+
71
+
72
+ function it_returns_the_last_request (RequestInterface $ request )
73
+ {
74
+ $ this ->sendRequest ($ request );
75
+
76
+ $ this ->getLastRequest ()->shouldReturn ($ request );
77
+ }
55
78
}
Original file line number Diff line number Diff line change @@ -100,4 +100,28 @@ public function getRequests()
100
100
{
101
101
return $ this ->requests ;
102
102
}
103
+
104
+ /**
105
+ * @return RequestInterface|false
106
+ */
107
+ public function getLastRequest ()
108
+ {
109
+ return end ($ this ->requests );
110
+ }
111
+
112
+ /**
113
+ * @return Exception|false
114
+ */
115
+ public function getLastException ()
116
+ {
117
+ return end ($ this ->exceptions );
118
+ }
119
+
120
+ /**
121
+ * @return ResponseInterface|false
122
+ */
123
+ public function getLastResponse ()
124
+ {
125
+ return end ($ this ->responses );
126
+ }
103
127
}
You can’t perform that action at this time.
0 commit comments