-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[local_auth] Improve iOS test DI (#3959)
Replaces test-specific code in the implementation with a more standard DI approach, where the objects to be mocked are provided by a factory passed in during initialization.
- Loading branch information
1 parent
e0ceb34
commit f452344
Showing
5 changed files
with
131 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 1.1.2 | ||
|
||
* Internal refactoring for maintainability. | ||
|
||
## 1.1.1 | ||
|
||
* Clarifies explanation of endorsement in README. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/local_auth/local_auth_ios/ios/Classes/FLTLocalAuthPlugin_Test.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#import <Flutter/Flutter.h> | ||
#import <LocalAuthentication/LocalAuthentication.h> | ||
|
||
/** | ||
* Protocol for a source of LAContext instances. Used to allow context injection in unit tests. | ||
*/ | ||
@protocol FLAAuthContextFactory <NSObject> | ||
- (LAContext *)createAuthContext; | ||
@end | ||
|
||
@interface FLTLocalAuthPlugin () | ||
/** | ||
* Returns an instance that uses the given factory to create LAContexts. | ||
*/ | ||
- (instancetype)initWithContextFactory:(NSObject<FLAAuthContextFactory> *)factory | ||
NS_DESIGNATED_INITIALIZER; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters