FIRMockInstallations.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. @property(nonatomic, copy) NSString *instanceID;
  27. @property(nonatomic, strong) NSError *error;
  28. @end
  29. @implementation FIRMockInstallations
  30. - (instancetype)initWithFID:(NSString *)installationID {
  31. FIRMockInstallationsImpl *mock = [[FIRMockInstallationsImpl alloc] init];
  32. mock.installationID = [installationID copy];
  33. mock.error = nil;
  34. self = (id)mock;
  35. return self;
  36. }
  37. - (instancetype)initWithError:(NSError *)error {
  38. FIRMockInstallationsImpl *mock = [[FIRMockInstallationsImpl alloc] init];
  39. mock.installationID = nil;
  40. mock.error = error;
  41. self = (id)mock;
  42. return self;
  43. }
  44. @end