Skip to content

Commit 43032c5

Browse files
committed
Fix unit tests (AppEnvironment required)
1 parent 393cf58 commit 43032c5

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

WordPress/Classes/Utility/Environment/AppEnvironment.swift renamed to Sources/WordPressData/Swift/AppEnvironment.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
import Foundation
22
import WordPressKit
33

4-
/// A collection of global variables and singletons that the app wants access to.
5-
///
6-
struct AppEnvironment {
4+
/// - warning: Soft-deprecated.
5+
public struct AppEnvironment {
76

87
// MARK: - Globals
98

109
/// A type to create derived context, save context, etc...
11-
let contextManager: CoreDataStackSwift
10+
public let contextManager: CoreDataStackSwift
1211

1312
/// The base url to use for WP.com api requests
14-
let wordPressComApiBase: URL
13+
public let wordPressComApiBase: URL
1514

1615
/// The mainContext that has concurrency type NSMainQueueConcurrencyType and should be used
1716
/// for UI elements and fetched results controllers.
18-
var mainContext: NSManagedObjectContext {
17+
public var mainContext: NSManagedObjectContext {
1918
return contextManager.mainContext
2019
}
2120

2221
// MARK: - Static current environment implementation
2322

2423
/// The current environment. Use this to access the app globals.
2524
///
26-
static private(set) var current = AppEnvironment()
25+
public static private(set) var current = AppEnvironment()
2726

2827
// MARK: - Initialization
2928

@@ -40,7 +39,7 @@ extension AppEnvironment {
4039
/// Creates a new Environment, changing just a subset of the current global dependencies.
4140
///
4241
@discardableResult
43-
static func replaceEnvironment(
42+
public static func replaceEnvironment(
4443
contextManager: CoreDataStackSwift = AppEnvironment.current.contextManager,
4544
wordPressComApiBase: URL = AppEnvironment.current.wordPressComApiBase) -> AppEnvironment {
4645

Sources/WordPressData/Swift/WordPressComRestApi+Defaults.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension WordPressComRestApi {
99
return WordPressComRestApi(oAuthToken: oAuthToken,
1010
userAgent: userAgent,
1111
localeKey: localeKey,
12-
baseURL: WordPressComRestApi.apiBaseURL)
12+
baseURL: AppEnvironment.current.wordPressComApiBase)
1313
}
1414

1515
/// Returns the default API the default WP.com account using the given context

WordPress/Classes/Utility/Editor/GutenbergSettings.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Foundation
12
import WordPressShared
23

34
/// Takes care of storing and accessing Gutenberg settings.

WordPress/Classes/ViewRelated/NUX/Helpers/WordPressAuthenticationManager.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import UIKit
22
import BuildSettingsKit
33
import SFHFKeychainUtils
44
import WordPressAuthenticator
5+
import WordPressData
56
import WordPressShared
67
import WordPressUI
78
import Gridicons

0 commit comments

Comments
 (0)