File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -84,4 +84,26 @@ function it_returns_false_when_there_is_no_last_request()
8484 {
8585 $ this ->getLastRequest ()->shouldReturn (false );
8686 }
87+
88+ function it_reset (
89+ ResponseFactory $ responseFactory ,
90+ RequestInterface $ request ,
91+ ResponseInterface $ response ,
92+ ResponseInterface $ newResponse
93+ ) {
94+ $ this ->addResponse ($ response );
95+ $ this ->setDefaultResponse ($ response );
96+ $ this ->addException (new \Exception ());
97+ $ this ->setDefaultException (new \Exception ());
98+
99+ $ responseFactory ->createResponse ()->willReturn ($ newResponse );
100+
101+ $ this ->reset ();
102+
103+ $ this ->sendRequest ($ request )->shouldReturn ($ newResponse );
104+
105+ $ this ->reset ();
106+
107+ $ this ->getRequests ()->shouldReturn ([]);
108+ }
87109}
Original file line number Diff line number Diff line change @@ -135,4 +135,13 @@ public function getLastRequest()
135135 {
136136 return end ($ this ->requests );
137137 }
138+
139+ public function reset ()
140+ {
141+ $ this ->responses = [];
142+ $ this ->exceptions = [];
143+ $ this ->requests = [];
144+ $ this ->setDefaultException ();
145+ $ this ->setDefaultResponse ();
146+ }
138147}
You can’t perform that action at this time.
0 commit comments