Skip to content

Commit f116beb

Browse files
committed
Moved test
1 parent ba62560 commit f116beb

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

tests/ConvertKitAPITest.php

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ protected function setUp(): void
6161
);
6262
}
6363

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+
6487
/**
6588
* Test that a ClientInterface can be injected.
6689
*
@@ -95,6 +118,12 @@ public function testClientInterfaceInjection()
95118
$this->assertSame('Test Account for Guzzle Mock', $result->name);
96119
$this->assertSame('free', $result->plan_type);
97120
$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());
98127
}
99128

100129
/**
@@ -223,29 +252,6 @@ public function testDebugDisabled()
223252
$this->assertEmpty($this->getLogFileContents());
224253
}
225254

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-
249255
/**
250256
* Test that get_oauth_url() returns the correct URL to begin the OAuth process.
251257
*

0 commit comments

Comments
 (0)