Skip to content

Commit b54bc7a

Browse files
authored
Add FirebaseCore test_spec (#2943)
1 parent fc1ebb8 commit b54bc7a

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ jobs:
3333
script:
3434
- travis_retry ./scripts/if_changed.sh ./scripts/build.sh $PROJECT $PLATFORM
3535

36+
- stage: test
37+
env:
38+
- PROJECT=Core PLATFORM=iOS METHOD=pod-lib-lint
39+
before_install:
40+
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
41+
script:
42+
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseCore.podspec
43+
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseCore.podspec --use-libraries
44+
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseCore.podspec --use-modular-headers
45+
3646
- stage: test
3747
env:
3848
- PROJECT=Functions PLATFORM=iOS METHOD=pod-lib-lint
@@ -67,7 +77,6 @@ jobs:
6777
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
6878
script:
6979
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh GoogleUtilities.podspec
70-
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseCore.podspec
7180
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseAnalyticsInterop.podspec
7281
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseAuth.podspec
7382
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseAuthInterop.podspec
@@ -98,7 +107,6 @@ jobs:
98107
- ./scripts/install_prereqs.sh
99108
script:
100109
- travis_retry ./scripts/pod_lib_lint.sh GoogleUtilities.podspec --use-libraries
101-
- travis_retry ./scripts/pod_lib_lint.sh FirebaseCore.podspec --use-libraries
102110
- travis_retry ./scripts/pod_lib_lint.sh FirebaseAnalyticsInterop.podspec --use-libraries
103111
- travis_retry ./scripts/pod_lib_lint.sh FirebaseAuth.podspec --use-libraries
104112
- travis_retry ./scripts/pod_lib_lint.sh FirebaseAuthInterop.podspec --use-libraries

Example/Core/Tests/FIROptionsTest.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ - (void)testInitCustomizedOptions {
100100
- (void)testInitWithContentsOfFile {
101101
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info"
102102
ofType:@"plist"];
103+
if (filePath == nil) {
104+
// Use bundleForClass to allow GoogleService-Info.plist to be in the test target's bundle.
105+
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
106+
filePath = [bundle pathForResource:@"GoogleService-Info" ofType:@"plist"];
107+
}
103108
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
104109
[self assertOptionsMatchDefaults:options andProjectID:YES];
105110
XCTAssertNil(options.deepLinkURLScheme);

FirebaseCore.podspec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,10 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
3636
'FIRCore_VERSION=' + s.version.to_s + ' Firebase_VERSION=5.20.0',
3737
'OTHER_CFLAGS' => '-fno-autolink'
3838
}
39+
s.test_spec 'unit' do |unit_tests|
40+
unit_tests.source_files = 'Example/Core/Tests/**/*.[mh]'
41+
unit_tests.requires_app_host = true
42+
unit_tests.dependency 'OCMock'
43+
unit_tests.resources = 'Example/Core/App/GoogleService-Info.plist'
44+
end
3945
end

scripts/if_changed.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ elif [[ -z "$TRAVIS_COMMIT_RANGE" ]]; then
4646
else
4747
case "$PROJECT-$METHOD" in
4848
Firebase-pod-lib-lint) # Combines Firebase-* and InAppMessaging*
49-
check_changes '^(Firebase/Auth|Firebase/Core|Firebase/Database|Firebase/DynamicLinks|'\
49+
check_changes '^(Firebase/Auth|Firebase/Database|Firebase/DynamicLinks|'\
5050
'Firebase/Messaging|Firebase/Storage|GoogleUtilities|Interop|Example|'\
5151
'FirebaseAnalyticsIntop.podspec|FirebaseAuth.podspec|FirebaseAuthInterop.podspec|'\
52-
'FirebaseCore.podspec|FirebaseDatabase.podspec|FirebaseDynamicLinks.podspec|'\
52+
'FirebaseDatabase.podspec|FirebaseDynamicLinks.podspec|'\
5353
'FirebaseMessaging.podspec|FirebaseStorage.podspec|'\
5454
'FirebaseStorage.podspec|Firebase/InAppMessagingDisplay|InAppMessagingDisplay|'\
5555
'InAppMessaging|Firebase/InAppMessaging|'\
@@ -66,6 +66,10 @@ else
6666
'FirebaseStorage.podspec|Firebase/InstanceID|FirebaseInstanceID.podspec)'
6767
;;
6868

69+
Core-*)
70+
check_changes '^(Firebase/Core|GoogleUtilities|FirebaseCore.podspec)'
71+
;;
72+
6973
Functions-*)
7074
check_changes '^(Firebase/Core|Functions|GoogleUtilities|FirebaseFunctions.podspec)'
7175
;;

0 commit comments

Comments
 (0)