FIRMockInstallations.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2020 Google LLC
  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 "Crashlytics/UnitTests/Mocks/FIRMockInstallations.h"
  15. #import <Foundation/Foundation.h>
  16. @interface FIRMockInstallationsImpl : NSObject
  17. @property(nonatomic, copy) NSString *installationID;
  18. @property(nonatomic, strong) NSError *error;
  19. @end
  20. @implementation FIRMockInstallationsImpl
  21. - (void)installationIDWithCompletion:(FIRInstallationsIDHandler)completion {
  22. completion(self.installationID, self.error);
  23. }
  24. @end
  25. @interface FIRMockInstallations ()
  26. @end
  27. @implementation FIRMockInstallations
  28. - (instancetype)initWithFID:(NSString *)installationID {
  29. FIRMockInstallationsImpl *mock = [[FIRMockInstallationsImpl alloc] init];
  30. mock.installationID = [installationID copy];
  31. mock.error = nil;
  32. self = (id)mock;
  33. return self;
  34. }
  35. - (instancetype)initWithError:(NSError *)error {
  36. FIRMockInstallationsImpl *mock = [[FIRMockInstallationsImpl alloc] init];
  37. mock.installationID = nil;
  38. mock.error = error;
  39. self = (id)mock;
  40. return self;
  41. }
  42. @end