Skip to content

Commit 05f847d

Browse files
authored
Added more test phone numbers. (#200)
* Added more test phone numbers. * proper array length tracking * added LogDebug message
1 parent 96d2c84 commit 05f847d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

auth/integration_test/src/integration_test.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ static const int kPhoneAuthCompletionWaitMs = 8000; // NOLINT
5656
static const int kPhoneAuthTimeoutMs = 0; // NOLINT
5757

5858
// Set these in Firebase Console for your app.
59-
static const char kPhoneAuthTestPhoneNumber[] = "+12345556789"; // NOLINT
60-
static const char kPhoneAuthTestVerificationCode[] = "123456"; // NOLINT
59+
static const char* kPhoneAuthTestPhoneNumbers[] = {
60+
"+12345556780", "+12345556781", "+12345556782", "+12345556783",
61+
"+12345556784", "+12345556785", "+12345556786", "+12345556787",
62+
"+12345556788", "+12345556789"}; // NOLINT
63+
static const char kPhoneAuthTestVerificationCode[] = "123456"; // NOLINT
64+
static const int kPhoneAuthTestNumPhoneNumbers =
65+
sizeof(kPhoneAuthTestPhoneNumbers) / sizeof(kPhoneAuthTestPhoneNumbers[0]);
6166

6267
static const char kTestPassword[] = "testEmailPassword123";
6368
static const char kTestEmailBad[] = "[email protected]";
@@ -860,8 +865,12 @@ TEST_F(FirebaseAuthTest, TestPhoneAuth) {
860865
LogDebug("Creating listener.");
861866
PhoneListener listener;
862867
LogDebug("Calling VerifyPhoneNumber.");
863-
phone_provider.VerifyPhoneNumber(kPhoneAuthTestPhoneNumber,
864-
kPhoneAuthTimeoutMs, nullptr, &listener);
868+
// Randomly choose one of the phone numbers to avoid collisions.
869+
const int random_phone_number =
870+
app_framework::GetCurrentTimeInMicroseconds() % kPhoneAuthTestNumPhoneNumbers;
871+
phone_provider.VerifyPhoneNumber(
872+
kPhoneAuthTestPhoneNumbers[random_phone_number], kPhoneAuthTimeoutMs,
873+
nullptr, &listener);
865874
// Wait for OnCodeSent() callback.
866875
int wait_ms = 0;
867876
LogDebug("Waiting for code send.");

0 commit comments

Comments
 (0)