Files
facebook-ios-sdk/TestTools/TestTools/TestGraphRequestConnectionFactory.swift
Jawwad Ahmad 624db61799 Add a swiftlint rule to prefer final classes
Summary:
There were only 2 instances in which I had to add a disable comment for prefer_final_classes due to subclassing

Used the following to add the final keyword (Adds final to any class that doesn't have final or open before it and doesn't have func after it)
```
find . -name '*.swift' | xargs perl -pi -e 's/(?<!final )(?<!open )(class (?!func).*\{)/final \1/g'
```

Reviewed By: samodom

Differential Revision: D34119233

fbshipit-source-id: 963d64fefc1686095d0bfe18ac7cb9677606f4e6
2022-02-09 23:10:04 -08:00

37 lines
1.0 KiB
Swift

/*
* 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
import Foundation
@objcMembers
public final class TestGraphRequestConnectionFactory: NSObject, GraphRequestConnectionFactoryProtocol {
public var stubbedConnection: GraphRequestConnecting?
public override init() {}
public init(stubbedConnection: GraphRequestConnecting) {
self.stubbedConnection = stubbedConnection
}
public static func create(
withStubbedConnection connection: GraphRequestConnecting
) -> TestGraphRequestConnectionFactory {
TestGraphRequestConnectionFactory(stubbedConnection: connection)
}
// MARK: - GraphRequestConnectionFactoryProtocol
public func createGraphRequestConnection() -> GraphRequestConnecting {
guard let connection = stubbedConnection else {
fatalError("Must stub a connection for a test connection factory")
}
return connection
}
}