Skip to content

Commit bc0329f

Browse files
fix the unit test #1451 (#2187)
1 parent 676c616 commit bc0329f

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

Example/Messaging/Tests/FIRMessagingRemoteNotificationsProxyTest.m

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,31 +162,23 @@ - (void)testSwizzlingAppDelegate {
162162
}
163163

164164
- (void)testSwizzledIncompleteAppDelegateRemoteNotificationMethod {
165-
IncompleteAppDelegate *incompleteAppDelegate = [[IncompleteAppDelegate alloc] init];
166-
[self.mockProxy swizzleAppDelegateMethods:incompleteAppDelegate];
167-
#ifdef BUG_1451
168-
SEL selector = @selector(application:didReceiveRemoteNotification:);
169-
XCTAssertTrue([incompleteAppDelegate respondsToSelector:selector]);
170-
[incompleteAppDelegate application:OCMClassMock([UIApplication class])
171-
didReceiveRemoteNotification:@{}];
172-
// Verify our swizzled method was called
173-
OCMVerify(FCM_swizzle_appDidReceiveRemoteNotification);
174-
#endif
165+
IncompleteAppDelegate *incompleteAppDelegate = [[IncompleteAppDelegate alloc] init];
166+
[self.mockProxy swizzleAppDelegateMethods:incompleteAppDelegate];
167+
168+
[incompleteAppDelegate application:OCMClassMock([UIApplication class])
169+
didReceiveRemoteNotification:@{}];
170+
// Verify our swizzled method was called
171+
OCMVerify(FCM_swizzle_appDidReceiveRemoteNotification);
175172
}
176173

177-
// If the remote notification with fetch handler is NOT implemented, we will force-implement
178-
// the backup -application:didReceiveRemoteNotification: method
179174
- (void)testIncompleteAppDelegateRemoteNotificationWithFetchHandlerMethod {
180175
IncompleteAppDelegate *incompleteAppDelegate = [[IncompleteAppDelegate alloc] init];
181176
[self.mockProxy swizzleAppDelegateMethods:incompleteAppDelegate];
182177
SEL remoteNotificationWithFetchHandler =
183178
@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:);
184179
XCTAssertFalse([incompleteAppDelegate respondsToSelector:remoteNotificationWithFetchHandler]);
185-
186-
#ifdef BUG_1451
187180
SEL remoteNotification = @selector(application:didReceiveRemoteNotification:);
188181
XCTAssertTrue([incompleteAppDelegate respondsToSelector:remoteNotification]);
189-
#endif
190182
}
191183

192184
- (void)testSwizzledAppDelegateRemoteNotificationMethods {

0 commit comments

Comments
 (0)