setUpFirebaseIntegrationTest function
- FirebaseMessagingPlatform? firebaseMessaging,
- FlutterLocalNotificationsPlatform? flutterLocalNotifications,
- FirebaseOptions? releaseOptions,
Setup function which can be called inside an integration test group to setup all the requirements needed for an integration test to run an app with Firebase notifications.
This sets up the platform-specific plugins with fakes. It also prepares Firebase for testing.
Implementation
void setUpFirebaseIntegrationTest({
FirebaseMessagingPlatform? firebaseMessaging,
FlutterLocalNotificationsPlatform? flutterLocalNotifications,
FirebaseOptions? releaseOptions,
}) {
if (!Platform.isAndroid && !Platform.isIOS) {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
}
setUpAll(() async {
if (kDebugMode) {
FirebaseMessagingPlatform.instance =
firebaseMessaging ?? setupFirebaseMessagingMocks();
FlutterLocalNotificationsPlatform.instance =
flutterLocalNotifications ?? FakeFlutterLocalNotificationsPlugin();
await Firebase.initializeApp();
} else {
await Firebase.initializeApp(options: releaseOptions);
}
});
}