FIROptionsMock.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/Extension/FIROptionsInternal.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. @interface FIROptionsMock ()
  29. @end
  30. @implementation FIROptionsMock
  31. // Swift Package manager does not allow a test project to override a bundle in an app (or library).
  32. + (void)mockFIROptions {
  33. NSDictionary<NSString *, NSString *> *mockDictionary = @{
  34. kFIRAPIKey : kAPIKey,
  35. kFIRBundleID : kBundleID,
  36. kFIRClientID : kClientID,
  37. kFIRDatabaseURL : kDatabaseURL,
  38. kFIRGCMSenderID : kGCMSenderID,
  39. kFIRGoogleAppID : kGoogleAppID,
  40. kFIRProjectID : kProjectID,
  41. kFIRStorageBucket : kStorageBucket,
  42. };
  43. id optionsClassMock = OCMClassMock([FIROptions class]);
  44. OCMStub([optionsClassMock defaultOptionsDictionary]).andReturn(mockDictionary);
  45. }
  46. @end