@@ -27,8 +27,26 @@ @interface FIRComponentContainer (TestInternal)
27
27
@property (nonatomic , strong ) NSMutableDictionary <NSString *, id> *cachedInstances;
28
28
29
29
+ (void )registerAsComponentRegistrant : (Class )klass inSet : (NSMutableSet <Class> *)allRegistrants ;
30
-
31
30
- (instancetype )initWithApp : (FIRApp *)app registrants : (NSMutableSet <Class> *)allRegistrants ;
31
+ + (void )setRegistrantSet : (NSMutableSet <Class> *)testInput ;
32
+ + (NSMutableSet <Class> *)registrantSet ;
33
+ @end
34
+
35
+ @interface FIRComponentContainer (TestInternalImplementations)
36
+ - (instancetype )initWithApp : (FIRApp *)app
37
+ components : (NSDictionary <NSString *, FIRComponentCreationBlock> *)components ;
38
+ @end
39
+
40
+ @implementation FIRComponentContainer (TestInternalImplementations)
41
+
42
+ - (instancetype )initWithApp : (FIRApp *)app
43
+ components : (NSDictionary <NSString *, FIRComponentCreationBlock> *)components {
44
+ self = [self initWithApp: app registrants: [[NSMutableSet alloc ] init ]];
45
+ if (self) {
46
+ components = [components mutableCopy ];
47
+ }
48
+ return self;
49
+ }
32
50
33
51
@end
34
52
@@ -41,10 +59,10 @@ @implementation FIRComponentContainerTest
41
59
#pragma mark - Registration Tests
42
60
43
61
- (void )testRegisteringConformingClass {
44
- NSMutableSet < Class > *allRegistrants = [NSMutableSet <Class > set];
62
+ [FIRComponentContainer setRegistrantSet: [NSMutableSet <Class > set] ];
45
63
Class testClass = [FIRTestClass class ];
46
- [FIRComponentContainer registerAsComponentRegistrant: testClass inSet: allRegistrants ];
47
- XCTAssertTrue ([allRegistrants containsObject: testClass]);
64
+ [FIRComponentContainer registerAsComponentRegistrant: testClass];
65
+ XCTAssertTrue ([[FIRComponentContainer registrantSet ] containsObject: testClass]);
48
66
}
49
67
50
68
- (void )testRegisteringNonConformingClass {
@@ -143,14 +161,15 @@ - (void)testProtocolAlreadyRegistered {
143
161
// / Create a container that has registered the test class.
144
162
- (FIRComponentContainer *)containerWithRegistrants : (NSArray <Class> *)registrants {
145
163
id appMock = OCMClassMock ([FIRApp class ]);
146
- NSMutableSet < Class > *allRegistrants = [NSMutableSet <Class > set];
164
+ [FIRComponentContainer setRegistrantSet: [NSMutableSet <Class > set] ];
147
165
148
166
// Initialize the container with the test classes.
149
167
for (Class c in registrants) {
150
- [FIRComponentContainer registerAsComponentRegistrant: c inSet: allRegistrants ];
168
+ [FIRComponentContainer registerAsComponentRegistrant: c];
151
169
}
152
170
153
- return [[FIRComponentContainer alloc ] initWithApp: appMock registrants: allRegistrants];
171
+ return [[FIRComponentContainer alloc ] initWithApp: appMock
172
+ registrants: [FIRComponentContainer registrantSet ]];
154
173
}
155
174
156
175
@end
0 commit comments