FIROptionsMock.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 kBundleID = @"com.google.FirebaseSDKTests";
  25. NSString *const kProjectID = @"abc-xyz-123";
  26. /**
  27. * Keys for the strings in the plist file.
  28. */
  29. extern NSString *const kFIRAPIKey;
  30. extern NSString *const kFIRTrackingID;
  31. extern NSString *const kFIRGoogleAppID;
  32. extern NSString *const kFIRClientID;
  33. extern NSString *const kFIRGCMSenderID;
  34. extern NSString *const kFIRAndroidClientID;
  35. extern NSString *const kFIRDatabaseURL;
  36. extern NSString *const kFIRStorageBucket;
  37. extern NSString *const kFIRBundleID;
  38. extern NSString *const kFIRProjectID;
  39. @interface FIROptions ()
  40. + (NSDictionary *)defaultOptionsDictionary;
  41. @end
  42. @interface FIROptionsMock ()
  43. @end
  44. @implementation FIROptionsMock
  45. // Swift Package manager does not allow a test project to override a bundle in an app (or library).
  46. + (void)mockFIROptions {
  47. NSDictionary<NSString *, NSString *> *mockDictionary = @{
  48. kFIRAPIKey : kAPIKey,
  49. kFIRBundleID : kBundleID,
  50. kFIRClientID : kClientID,
  51. kFIRDatabaseURL : kDatabaseURL,
  52. kFIRGCMSenderID : kGCMSenderID,
  53. kFIRGoogleAppID : kGoogleAppID,
  54. kFIRProjectID : kProjectID,
  55. kFIRStorageBucket : kStorageBucket,
  56. };
  57. id optionsClassMock = OCMClassMock([FIROptions class]);
  58. OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
  59. }
  60. @end