FIRComponentTestUtilities.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "SharedTestUtilities/FIRComponentTestUtilities.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. @interface FIRComponentContainer (TestingPrivate)
  19. // Expose the private property in FIRComponentContainer for manually setting in the custom
  20. // constructor.
  21. @property(nonatomic, strong) NSMutableDictionary<NSString *, FIRComponentCreationBlock> *components;
  22. @end
  23. @implementation FIRComponentContainer (TestingPrivate)
  24. // Dynamic so the internal property exposed above doesn't get overridden by compiler generated
  25. // getters and setters.
  26. @dynamic components;
  27. - (instancetype)initWithApp:(FIRApp *)app
  28. components:(NSDictionary<NSString *, FIRComponentCreationBlock> *)components {
  29. self = [self initWithApp:app registrants:[[NSMutableSet alloc] init]];
  30. if (self) {
  31. // Explicitly use `self.components` here since we don't have access to the ivar underneath.
  32. self.components = [components mutableCopy];
  33. }
  34. return self;
  35. }
  36. @end
  37. NS_ASSUME_NONNULL_END