FIROptionsMock.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2017 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "OCMock.h"
  15. #import "FirebaseCore/Sources/Private/FIROptionsInternal.h"
  16. #import "SharedTestUtilities/FIROptionsMock.h"
  17. NSString *const kAndroidClientID = @"correct_android_client_id";
  18. NSString *const kAPIKey = @"correct_api_key";
  19. NSString *const kCustomizedAPIKey = @"customized_api_key";
  20. NSString *const kClientID = @"correct_client_id";
  21. NSString *const kTrackingID = @"correct_tracking_id";
  22. NSString *const kGCMSenderID = @"correct_gcm_sender_id";
  23. NSString *const kGoogleAppID = @"1:123:ios:123abc";
  24. NSString *const kDatabaseURL = @"https://abc-xyz-123.firebaseio.com";
  25. NSString *const kStorageBucket = @"project-id-123.storage.firebase.com";
  26. NSString *const kDeepLinkURLScheme = @"comgoogledeeplinkurl";
  27. NSString *const kNewDeepLinkURLScheme = @"newdeeplinkurlfortest";
  28. NSString *const kBundleID = @"com.google.FirebaseSDKTests";
  29. NSString *const kProjectID = @"abc-xyz-123";
  30. @interface FIROptionsMock ()
  31. @end
  32. @implementation FIROptionsMock
  33. // Swift Package manager does not allow a test project to override a bundle in an app (or library).
  34. + (void)mockFIROptions {
  35. NSDictionary<NSString *, NSString *> *mockDictionary = @{
  36. kFIRAPIKey : kAPIKey,
  37. kFIRBundleID : kBundleID,
  38. kFIRClientID : kClientID,
  39. kFIRDatabaseURL : kDatabaseURL,
  40. kFIRGCMSenderID : kGCMSenderID,
  41. kFIRGoogleAppID : kGoogleAppID,
  42. kFIRProjectID : kProjectID,
  43. kFIRStorageBucket : kStorageBucket,
  44. kFIRTrackingID : kTrackingID,
  45. };
  46. id optionsClassMock = OCMClassMock([FIROptions class]);
  47. OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
  48. }
  49. @end