File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,11 @@ function it_logs_request_and_response(
40
40
ResponseInterface $ response
41
41
) {
42
42
$ formatter ->formatRequest ($ request )->willReturn ('GET / 1.1 ' );
43
- $ formatter ->formatResponse ($ response )->willReturn ('200 OK 1.1 ' );
44
- $ formatter ->formatResponseForRequest ($ response , $ request )->willReturn ('200 OK 1.1 ' );
43
+ if (method_exists (Formatter \SimpleFormatter::class, 'formatResponseForRequest ' )) {
44
+ $ formatter ->formatResponseForRequest ($ response , $ request )->willReturn ('200 OK 1.1 ' );
45
+ } else {
46
+ $ formatter ->formatResponse ($ response )->willReturn ('200 OK 1.1 ' );
47
+ }
45
48
46
49
$ logger ->info (
47
50
"Sending request: \nGET / 1.1 " ,
@@ -109,8 +112,11 @@ function it_logs_response_within_exception(
109
112
ResponseInterface $ response
110
113
) {
111
114
$ formatter ->formatRequest ($ request )->willReturn ('GET / 1.1 ' );
112
- $ formatter ->formatResponse ($ response )->willReturn ('403 Forbidden 1.1 ' );
113
- $ formatter ->formatResponseForRequest ($ response , $ request )->willReturn ('403 Forbidden 1.1 ' );
115
+ if (method_exists (Formatter \SimpleFormatter::class, 'formatResponseForRequest ' )) {
116
+ $ formatter ->formatResponseForRequest ($ response , $ request )->willReturn ('403 Forbidden 1.1 ' );
117
+ } else {
118
+ $ formatter ->formatResponse ($ response )->willReturn ('403 Forbidden 1.1 ' );
119
+ }
114
120
115
121
$ exception = new HttpException ('Forbidden ' , $ request ->getWrappedObject (), $ response ->getWrappedObject ());
116
122
You can’t perform that action at this time.
0 commit comments