@@ -18,6 +18,8 @@ class OTPServiceTest extends TestCase
1818 "key " => "12345678901234567890 "
1919 ];
2020
21+ protected $ phone_number = 919999999999 ;
22+
2123 protected $ container = [];
2224
2325 protected function setUp (): void
@@ -46,7 +48,7 @@ protected function createMockHttpClient(
4648
4749 public function test_otp_send ()
4850 {
49- $ phone_number = 919999999999 ;
51+ $ phone_number = $ this -> phone_number ;
5052 $ response = (new Client ($ this ->config , $ this ->createMockHttpClient ()))
5153 ->otp ()
5254 ->from ("SMSIND " )
@@ -70,7 +72,7 @@ public function test_otp_send()
7072
7173 public function test_verify_otp ()
7274 {
73- $ phone_number = 919999999999 ;
75+ $ phone_number = $ this -> phone_number ;
7476 $ otp = 1234 ;
7577 $ response = (new Client ($ this ->config , $ this ->createMockHttpClient ()))
7678 ->otp ($ otp )
@@ -95,7 +97,7 @@ public function test_verify_otp()
9597
9698 public function test_otp_resend ()
9799 {
98- $ phone_number = 919999999999 ;
100+ $ phone_number = $ this -> phone_number ;
99101 $ response = (new Client ($ this ->config , $ this ->createMockHttpClient ()))
100102 ->otp ()
101103 ->to ($ phone_number )
@@ -109,7 +111,7 @@ public function test_otp_resend()
109111 // check the method
110112 $ this ->assertEquals ("POST " , $ transaction ['request ' ]->getMethod ());
111113 // check the request data
112- $ data = ( array ) json_decode ( $ transaction ['request ' ]->getBody ()->getContents ());
114+ parse_str ( $ transaction ['request ' ]->getBody ()->getContents (), $ data );
113115 $ this ->assertArrayHasKey ('mobile ' , $ data );
114116 $ this ->assertEquals ($ phone_number , $ data ['mobile ' ]);
115117 $ this ->assertArrayHasKey ('authkey ' , $ data );
@@ -120,7 +122,7 @@ public function test_otp_resend()
120122
121123 public function test_api_key_required ()
122124 {
123- $ phone_number = 919999999999 ;
125+ $ phone_number = $ this -> phone_number ;
124126 $ this ->expectException (ValidationException::class);
125127 (new Client ([], $ this ->createMockHttpClient ()))
126128 ->otp ()
0 commit comments