-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstracting dependencies for
FBSDKLoginButton
Summary: In order to further increase some test coverage, some dependencies needed to be abstracted as we need to pass different underlying types when testing. Increased test coverage for login button and login kit. Before: {F710854289} {F710854034} After: {F710854337} {F710854079} Reviewed By: samodom Differential Revision: D34774326 fbshipit-source-id: e8d5197af05b53fd3346f5180869e0ee713dbf72
- Loading branch information
1 parent
0d2160b
commit 76fbbbd
Showing
9 changed files
with
344 additions
and
114 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
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
13 changes: 13 additions & 0 deletions
13
FBSDKLoginKit/FBSDKLoginKit/Internal/InternalUtilityExtensions.swift
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,13 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import FBSDKCoreKit | ||
|
||
extension InternalUtility: UserInterfaceElementProviding {} | ||
|
||
extension InternalUtility: UserInterfaceStringProviding {} |
16 changes: 16 additions & 0 deletions
16
FBSDKLoginKit/FBSDKLoginKit/Internal/UserInterfaceElementProviding.swift
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,16 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import UIKit | ||
|
||
@objc(FBSDKUserInterfaceElementProviding) | ||
public protocol UserInterfaceElementProviding { | ||
func topMostViewController() -> UIViewController? | ||
@objc(viewControllerForView:) | ||
func viewController(for view: UIView) -> UIViewController? | ||
} |
14 changes: 14 additions & 0 deletions
14
FBSDKLoginKit/FBSDKLoginKit/Internal/UserInterfaceStringProviding.swift
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,14 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import Foundation | ||
|
||
@objc(FBSDKUserInterfaceStringProviding) | ||
public protocol UserInterfaceStringProviding { | ||
var bundleForStrings: Bundle { get } | ||
} |
23 changes: 23 additions & 0 deletions
23
FBSDKLoginKit/FBSDKLoginKitTests/Helpers/TestUserInterfaceElementProvider.swift
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,23 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import FBSDKCoreKit | ||
|
||
final class TestUserInterfaceElementProvider: UserInterfaceElementProviding { | ||
var stubbedTopMostViewController: UIViewController? | ||
var capturedView: UIView? | ||
|
||
func topMostViewController() -> UIViewController? { | ||
stubbedTopMostViewController | ||
} | ||
|
||
func viewController(for view: UIView) -> UIViewController? { | ||
capturedView = view | ||
return stubbedTopMostViewController | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
FBSDKLoginKit/FBSDKLoginKitTests/Helpers/TestUserInterfaceStringProvider.swift
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,17 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import FBSDKCoreKit | ||
|
||
final class TestUserInterfaceStringProvider: UserInterfaceStringProviding { | ||
var stubbedBundleForStrings: Bundle? | ||
|
||
var bundleForStrings: Bundle { | ||
stubbedBundleForStrings ?? .main | ||
} | ||
} |
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
Oops, something went wrong.