disable firebase for tests

This commit is contained in:
triplem 2019-08-01 21:20:17 +02:00
parent b3dde001d8
commit c9f054bd47
4 changed files with 6 additions and 1 deletions

View file

@ -19,7 +19,7 @@ before_install:
script:
# Unit Test
- ./gradlew -Pcoverage testFullDebugUnitTest jacocoTestFullDebugUnitTestReport
- ./gradlew -Pcoverage -PfirebaseDisable testFullDebugUnitTest jacocoTestFullDebugUnitTestReport
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -145,6 +145,9 @@ android {
debug {
testCoverageEnabled(project.hasProperty('coverage'))
}
firebaseDisable {
System.setProperty("disableFirebase", "true")
}
}
productFlavors {
flavorDimensions "standard"

View file

@ -148,6 +148,7 @@ public class MainApp extends Application {
}
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.setAnalyticsCollectionEnabled(!Boolean.getBoolean("disableFirebase"));
JodaTimeAndroid.init(this);

View file

@ -159,6 +159,7 @@ public class AAPSMocker {
}
public static MainApp mockMainApp() {
System.setProperty("disableFirebase", "true");
PowerMockito.mockStatic(MainApp.class);
MainApp mainApp = mock(MainApp.class);
when(MainApp.instance()).thenReturn(mainApp);