Merge pull request #1928 from triplem/firebase_events_test
disable firebase for tests
This commit is contained in:
commit
d467d679df
4 changed files with 6 additions and 1 deletions
|
@ -19,7 +19,7 @@ before_install:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Unit Test
|
# Unit Test
|
||||||
- ./gradlew -Pcoverage testFullDebugUnitTest jacocoTestFullDebugUnitTestReport
|
- ./gradlew -Pcoverage -PfirebaseDisable testFullDebugUnitTest jacocoTestFullDebugUnitTestReport
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
|
@ -143,6 +143,9 @@ android {
|
||||||
debug {
|
debug {
|
||||||
testCoverageEnabled(project.hasProperty('coverage'))
|
testCoverageEnabled(project.hasProperty('coverage'))
|
||||||
}
|
}
|
||||||
|
firebaseDisable {
|
||||||
|
System.setProperty("disableFirebase", "true")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
productFlavors {
|
productFlavors {
|
||||||
flavorDimensions "standard"
|
flavorDimensions "standard"
|
||||||
|
|
|
@ -148,6 +148,7 @@ public class MainApp extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||||
|
mFirebaseAnalytics.setAnalyticsCollectionEnabled(!Boolean.getBoolean("disableFirebase"));
|
||||||
|
|
||||||
JodaTimeAndroid.init(this);
|
JodaTimeAndroid.init(this);
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class AAPSMocker {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainApp mockMainApp() {
|
public static MainApp mockMainApp() {
|
||||||
|
System.setProperty("disableFirebase", "true");
|
||||||
PowerMockito.mockStatic(MainApp.class);
|
PowerMockito.mockStatic(MainApp.class);
|
||||||
MainApp mainApp = mock(MainApp.class);
|
MainApp mainApp = mock(MainApp.class);
|
||||||
when(MainApp.instance()).thenReturn(mainApp);
|
when(MainApp.instance()).thenReturn(mainApp);
|
||||||
|
|
Loading…
Reference in a new issue