diff --git a/src/Verify2/ClientFactory.php b/src/Verify2/ClientFactory.php index 8bca137a..0d213683 100644 --- a/src/Verify2/ClientFactory.php +++ b/src/Verify2/ClientFactory.php @@ -15,7 +15,7 @@ public function __invoke(ContainerInterface $container): Client $api->setIsHAL(false) ->setErrorsOn200(false) ->setAuthHandlers([new KeypairHandler(), new BasicHandler()]) - ->setBaseUrl('https://api.nexmo.com/v2/verify'); + ->setBaseUri('/v2/verify'); return new Client($api); } diff --git a/test/Verify2/ClientFactoryTest.php b/test/Verify2/ClientFactoryTest.php index b5e68391..eccfddfa 100644 --- a/test/Verify2/ClientFactoryTest.php +++ b/test/Verify2/ClientFactoryTest.php @@ -20,6 +20,7 @@ public function testInvokeCreatesClientWithConfiguredApiResource(): void ]; $mockClient = $this->createMock(Client::class); + $mockClient->method('getApiUrl')->willReturn('https://api.nexmo.com'); $container = new MapFactory($mockServices, $mockClient); $factory = new ClientFactory(); @@ -29,7 +30,8 @@ public function testInvokeCreatesClientWithConfiguredApiResource(): void ->getAuthHandlers()[0]); $this->assertInstanceOf(Client\Credentials\Handler\BasicHandler::class, $result->getAPIResource() ->getAuthHandlers()[1]); - $this->assertEquals('https://api.nexmo.com/v2/verify', $result->getAPIResource()->getBaseUrl()); + $this->assertEquals('https://api.nexmo.com', $result->getAPIResource()->getBaseUrl()); + $this->assertEquals('/v2/verify', $result->getAPIResource()->getBaseUri()); $this->assertFalse($result->getApiResource()->errorsOn200()); $this->assertFalse($result->getApiResource()->isHAL()); }