@@ -61,6 +61,29 @@ protected function setUp(): void
61
61
);
62
62
}
63
63
64
+ /**
65
+ * Test that a Response instance is returned when calling getResponseInterface()
66
+ * after making an API request.
67
+ *
68
+ * @since 2.0.0
69
+ *
70
+ * @return void
71
+ */
72
+ public function testGetResponseInterface ()
73
+ {
74
+ // Assert response interface is null, as no API request made.
75
+ $ this ->assertNull ($ this ->api ->getResponseInterface ());
76
+
77
+ // Perform an API request.
78
+ $ result = $ this ->api ->get_account ();
79
+
80
+ // Assert response interface is of a valid type.
81
+ $ this ->assertInstanceOf (Response::class, $ this ->api ->getResponseInterface ());
82
+
83
+ // Assert the correct status code was returned.
84
+ $ this ->assertEquals (200 , $ this ->api ->getResponseInterface ()->getStatusCode ());
85
+ }
86
+
64
87
/**
65
88
* Test that a ClientInterface can be injected.
66
89
*
@@ -95,6 +118,12 @@ public function testClientInterfaceInjection()
95
118
$ this ->assertSame ('Test Account for Guzzle Mock ' , $ result ->name );
96
119
$ this ->assertSame ('free ' , $ result ->plan_type );
97
120
$ this ->
assertSame (
'[email protected] ' ,
$ result->
primary_email_address );
121
+
122
+ // Assert response interface is of a valid type when using `set_http_client`.
123
+ $ this ->assertInstanceOf (Response::class, $ this ->api ->getResponseInterface ());
124
+
125
+ // Assert the correct status code was returned.
126
+ $ this ->assertEquals (200 , $ this ->api ->getResponseInterface ()->getStatusCode ());
98
127
}
99
128
100
129
/**
@@ -223,29 +252,6 @@ public function testDebugDisabled()
223
252
$ this ->assertEmpty ($ this ->getLogFileContents ());
224
253
}
225
254
226
- /**
227
- * Test that a Response instance is returned when calling getResponseInterface()
228
- * after making an API request.
229
- *
230
- * @since 2.0.0
231
- *
232
- * @return void
233
- */
234
- public function testGetResponseInterface ()
235
- {
236
- // Assert response interface is null, as no API request made.
237
- $ this ->assertNull ($ this ->api ->getResponseInterface ());
238
-
239
- // Perform an API request.
240
- $ result = $ this ->api ->get_account ();
241
-
242
- // Assert response interface is of a valid type.
243
- $ this ->assertInstanceOf (Response::class, $ this ->api ->getResponseInterface ());
244
-
245
- // Assert the correct status code was returned.
246
- $ this ->assertEquals (200 , $ this ->api ->getResponseInterface ()->getStatusCode ());
247
- }
248
-
249
255
/**
250
256
* Test that get_oauth_url() returns the correct URL to begin the OAuth process.
251
257
*
0 commit comments