15
15
//
16
16
17
17
@import XCTest;
18
- @import FirebaseAuth ;
18
+ @import FirebaseCore ;
19
19
@import FirebaseAuthUI;
20
- #import < OCMock/OCMock.h>
21
20
#import " FUIAuthUtils.h"
22
21
23
22
@interface FUILoginProvider : NSObject <FUIAuthProvider>
@@ -44,24 +43,35 @@ - (UIColor *)buttonTextColor {
44
43
return [UIColor whiteColor ];
45
44
}
46
45
46
+ #pragma clang diagnostic push
47
+ #pragma clang diagnostic ignored "-Wdeprecated-implementations"
47
48
- (void )signInWithEmail : (NSString *)email
48
49
presentingViewController : (UIViewController *)presentingViewController
49
50
completion : (FIRAuthProviderSignInCompletionBlock)completion {}
51
+ #pragma clang diagnostic pop
50
52
51
53
- (void )signOut {}
52
54
53
55
- (BOOL )handleOpenURL : (NSURL *)URL sourceApplication : (NSString *)sourceApplication {
54
56
return self.canHandleURLs ;
55
57
}
56
58
59
+ - (void )signInWithDefaultValue : (nullable NSString *)defaultValue
60
+ presentingViewController : (nullable UIViewController *)presentingViewController
61
+ completion : (nullable FIRAuthProviderSignInCompletionBlock)completion {}
62
+
63
+
57
64
@end
58
65
59
66
@interface FUIAuthUIDelegate : NSObject <FUIAuthDelegate>
60
67
@end
61
68
62
69
@implementation FUIAuthUIDelegate
70
+ #pragma clang diagnostic push
71
+ #pragma clang diagnostic ignored "-Wdeprecated-implementations"
63
72
- (void )authUI : (FUIAuth *)authUI didSignInWithUser : (FIRUser *)user error : (NSError *)error {
64
73
}
74
+ #pragma clang diagnostic pop
65
75
66
76
- (FUIAuthPickerViewController *)authPickerViewControllerForAuthUI : (FUIAuth *)authUI {
67
77
Class controllerClass = [FUIAuthPickerViewController class ];
@@ -83,16 +93,13 @@ @implementation FUIAuthTest
83
93
84
94
- (void )setUp {
85
95
[super setUp ];
86
- id authClass = OCMClassMock ([FIRAuth class ]);
87
- OCMStub (ClassMethod ([authClass auth ])).
88
- andReturn (authClass);
89
96
90
- id mockUtilsClass = OCMClassMock ([FUIAuthUtils class ]);
91
- OCMStub ( ClassMethod ([mockUtilsClass bundleNamed: OCMOCK_ANY])).
92
- andReturn ([ NSBundle bundleForClass: [FUIAuth class ]]);
97
+ if ([FIRApp defaultApp ] == nil ) {
98
+ [FIRApp configure ];
99
+ }
93
100
94
- self.auth = [FIRAuth auth ];
95
- self.authUI = [FUIAuth defaultAuthUI ];
101
+ self.auth = [FIRAuth authWithApp: [FIRApp defaultApp ] ];
102
+ self.authUI = [FUIAuth authUIWithAuth: self .auth ];
96
103
self.delegate = [[FUIAuthUIDelegate alloc ] init ];
97
104
}
98
105
0 commit comments