diff --git a/src/Client.php b/src/Client.php index 06fbe63..b21d036 100644 --- a/src/Client.php +++ b/src/Client.php @@ -157,25 +157,6 @@ public function setBaseURL(UriInterface $baseURL) return $this; } - /** - * @param bool $enable - * @return $this - */ - public function useSecureBaseURL($enable = true) - { - if ($enable) { - $this->baseURL = new Uri(self::DEFAULT_BASE_URL); - $this->longMessageBaseURL = new Uri(self::DEFAULT_LONG_MESSAGE_BASE_URL); - - return $this; - } - - $this->baseURL = new Uri(self::DEFAULT_HTTP_BASE_URL); - $this->longMessageBaseURL = new Uri(self::DEFAULT_LONG_MESSAGE_HTTP_BASE_URL); - - return $this; - } - /** * @return UriInterface */ @@ -195,6 +176,25 @@ public function setLongMessageBaseURL(UriInterface $longMessageBaseURL) return $this; } + /** + * @param bool $enable + * @return $this + */ + public function useSecureBaseURL($enable = true) + { + if ($enable) { + $this->baseURL = new Uri(self::DEFAULT_BASE_URL); + $this->longMessageBaseURL = new Uri(self::DEFAULT_LONG_MESSAGE_BASE_URL); + + return $this; + } + + $this->baseURL = new Uri(self::DEFAULT_HTTP_BASE_URL); + $this->longMessageBaseURL = new Uri(self::DEFAULT_LONG_MESSAGE_HTTP_BASE_URL); + + return $this; + } + /** * Send an API request * diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 81b4bfd..b71f13e 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -103,19 +103,17 @@ public function testBuildUriWithQuery($uri, $queryParams, $expected) $this->assertEquals($expected, $actual); } - public function testUseSecureBaseURL() - { - $client = $this->createClient(); - $client->useSecureBaseURL(); - - $this->assertEquals(Client::DEFAULT_BASE_URL, $client->getBaseURL()); - } - - public function testNoUseSecureBaseURL() + public function testShouldBeOkWhenUseSecureBaseURL() { $client = $this->createClient(); $client->useSecureBaseURL(false); $this->assertEquals(Client::DEFAULT_HTTP_BASE_URL, $client->getBaseURL()); + $this->assertEquals(Client::DEFAULT_LONG_MESSAGE_HTTP_BASE_URL, $client->getLongMessageBaseURL()); + + $client->useSecureBaseURL(); + + $this->assertEquals(Client::DEFAULT_BASE_URL, $client->getBaseURL()); + $this->assertEquals(Client::DEFAULT_LONG_MESSAGE_BASE_URL, $client->getLongMessageBaseURL()); } }