FIROptionsMock.m 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/OCMock.h>
  15. #import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
  16. #import "SharedTestUtilities/FIROptionsMock.h"
  17. NSString *const kAPIKey = @"correct_api_key";
  18. NSString *const kCustomizedAPIKey = @"customized_api_key";
  19. NSString *const kClientID = @"correct_client_id";
  20. NSString *const kGCMSenderID = @"correct_gcm_sender_id";
  21. NSString *const kGoogleAppID = @"1:123:ios:123abc";
  22. NSString *const kDatabaseURL = @"https://abc-xyz-123.firebaseio.com";
  23. NSString *const kStorageBucket = @"project-id-123.storage.firebase.com";
  24. NSString *const kDeepLinkURLScheme = @"comgoogledeeplinkurl";
  25. NSString *const kNewDeepLinkURLScheme = @"newdeeplinkurlfortest";
  26. NSString *const kBundleID = @"com.google.FirebaseSDKTests";
  27. NSString *const kProjectID = @"abc-xyz-123";
  28. /**
  29. * Keys for the strings in the plist file.
  30. */
  31. extern NSString *const kFIRAPIKey;
  32. extern NSString *const kFIRTrackingID;
  33. extern NSString *const kFIRGoogleAppID;
  34. extern NSString *const kFIRClientID;
  35. extern NSString *const kFIRGCMSenderID;
  36. extern NSString *const kFIRAndroidClientID;
  37. extern NSString *const kFIRDatabaseURL;
  38. extern NSString *const kFIRStorageBucket;
  39. extern NSString *const kFIRBundleID;
  40. extern NSString *const kFIRProjectID;
  41. @interface FIROptions ()
  42. + (NSDictionary *)defaultOptionsDictionary;
  43. @end
  44. @interface FIROptionsMock ()
  45. @end
  46. @implementation FIROptionsMock
  47. // Swift Package manager does not allow a test project to override a bundle in an app (or library).
  48. + (void)mockFIROptions {
  49. NSDictionary<NSString *, NSString *> *mockDictionary = @{
  50. kFIRAPIKey : kAPIKey,
  51. kFIRBundleID : kBundleID,
  52. kFIRClientID : kClientID,
  53. kFIRDatabaseURL : kDatabaseURL,
  54. kFIRGCMSenderID : kGCMSenderID,
  55. kFIRGoogleAppID : kGoogleAppID,
  56. kFIRProjectID : kProjectID,
  57. kFIRStorageBucket : kStorageBucket,
  58. };
  59. id optionsClassMock = OCMClassMock([FIROptions class]);
  60. OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
  61. }
  62. @end