From e472cada2a7c2690030decf379891e0820c291ab Mon Sep 17 00:00:00 2001 From: James Seconde Date: Tue, 24 Oct 2023 10:40:56 +0100 Subject: [PATCH] remove verification checks, API behaviour too unstable currently (#449) --- .../VerifyObjects/VerificationLocale.php | 43 ------------------- test/Verify2/ClientTest.php | 39 ----------------- 2 files changed, 82 deletions(-) diff --git a/src/Verify2/VerifyObjects/VerificationLocale.php b/src/Verify2/VerifyObjects/VerificationLocale.php index 38632f8c..6f0d8434 100644 --- a/src/Verify2/VerifyObjects/VerificationLocale.php +++ b/src/Verify2/VerifyObjects/VerificationLocale.php @@ -4,51 +4,8 @@ class VerificationLocale { - private array $allowedCodes = [ - 'fr-fr', - 'en-gb', - 'en-us', - 'es-es', - 'es-us', - 'it-it', - 'de-de', - 'pt-br', - 'pt-pt', - 'ru-ru', - 'hi-in', - 'id-id', - 'he-il', - 'yue-cn', - 'ja-jp', - 'ar-xa', - 'cs-cz', - 'cy-gb', - 'el-gr', - 'en-au', - 'en-in', - 'es-mx', - 'fi-fi', - 'fil-ph', - 'fr-ca', - 'hu-hu', - 'is-is', - 'nb-no', - 'nl-nl', - 'pl-pl', - 'ro-ro', - 'sv-se', - 'th-th', - 'tr-tr', - 'vi-vn', - 'zh-cn', - 'zh-tw' - ]; - public function __construct(protected string $code = 'en-us') { - if (! in_array($code, $this->allowedCodes, true)) { - throw new \InvalidArgumentException('Invalid Locale Code Provided'); - } } public function getCode(): string diff --git a/test/Verify2/ClientTest.php b/test/Verify2/ClientTest.php index 2193dcff..6d7be95a 100644 --- a/test/Verify2/ClientTest.php +++ b/test/Verify2/ClientTest.php @@ -138,45 +138,6 @@ public function testCanBypassFraudCheck(): void $this->assertArrayHasKey('request_id', $result); } - /** - * @dataProvider localeProvider - */ - public function testCannotRequestSMSWithInvalidLocale($locale, $valid): void - { - if (!$valid) { - $this->expectException(\InvalidArgumentException::class); - } - - $verificationLocale = new VerificationLocale($locale); - - $payload = [ - 'to' => '07785254785', - 'client_ref' => 'my-verification', - 'brand' => 'my-brand', - 'locale' => $verificationLocale, - ]; - - $smsVerification = new SMSRequest($payload['to'], $payload['brand'], $payload['locale']); - $smsVerification->setClientRef($payload['client_ref']); - - $this->vonageClient->send(Argument::that(function (Request $request) use ($payload) { - $this->assertEquals( - 'Basic ', - mb_substr($request->getHeaders()['Authorization'][0], 0, 6) - ); - - $this->assertRequestJsonBodyContains('locale', $payload['locale']->getCode(), $request); - $this->assertEquals('POST', $request->getMethod()); - - return true; - }))->willReturn($this->getResponse('verify-request-success', 202)); - - $result = $this->verify2Client->startVerification($smsVerification); - - $this->assertIsArray($result); - $this->assertArrayHasKey('request_id', $result); - } - /** * @dataProvider timeoutProvider */