From 0fd8eb6cc0d661060083edf87c180e0385eecf03 Mon Sep 17 00:00:00 2001 From: Worthing ~ <115107835+w-goog@users.noreply.github.com> Date: Fri, 4 Dec 2026 16:12:58 -0800 Subject: [PATCH] g-orchestrated: stub OIDAuthorizationService class methods with ClassMethod() --- GoogleSignIn/Tests/Unit/GIDSignInTest.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/GoogleSignIn/Tests/Unit/GIDSignInTest.m b/GoogleSignIn/Tests/Unit/GIDSignInTest.m index acc147e1..3acf91fc 100644 --- a/GoogleSignIn/Tests/Unit/GIDSignInTest.m +++ b/GoogleSignIn/Tests/Unit/GIDSignInTest.m @@ -321,18 +321,20 @@ - (void)setUp { }); _user = OCMStrictClassMock([GIDGoogleUser class]); _oidAuthorizationService = OCMStrictClassMock([OIDAuthorizationService class]); - OCMStub([_oidAuthorizationService + // AppAuth 3.1.0 has instance methods with these selectors. Without ClassMethod(), OCMock + // stubs the instance methods, and these stubs never run. + OCMStub(ClassMethod([_oidAuthorizationService presentAuthorizationRequest:SAVE_TO_ARG_BLOCK(self->_savedAuthorizationRequest) #if TARGET_OS_IOS || TARGET_OS_MACCATALYST presentingViewController:SAVE_TO_ARG_BLOCK(self->_savedPresentingViewController) #elif TARGET_OS_OSX presentingWindow:SAVE_TO_ARG_BLOCK(self->_savedPresentingWindow) #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST - callback:COPY_TO_ARG_BLOCK(self->_savedAuthorizationCallback)]); - OCMStub([self->_oidAuthorizationService + callback:COPY_TO_ARG_BLOCK(self->_savedAuthorizationCallback)])); + OCMStub(ClassMethod([self->_oidAuthorizationService performTokenRequest:SAVE_TO_ARG_BLOCK(self->_savedTokenRequest) originalAuthorizationResponse:[OCMArg any] - callback:COPY_TO_ARG_BLOCK(self->_savedTokenCallback)]); + callback:COPY_TO_ARG_BLOCK(self->_savedTokenCallback)])); // Fakes _authStateMigrationService = [[GIDFakeAuthStateMigration alloc] init];