Skip to content

Commit 88c0214

Browse files
committed
Remove redunant 'open' keywords from Tests
1 parent 62a373e commit 88c0214

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

Tests/Helpers/Mocks.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import NWWebSocket
44

55
@testable import PusherSwift
66

7-
open class MockWebSocket: NWWebSocket {
7+
class MockWebSocket: NWWebSocket {
88
let stubber = StubberForMocks()
99
var callbackCheckString: String = ""
1010
var objectGivenToCallback: Any?
@@ -14,19 +14,19 @@ open class MockWebSocket: NWWebSocket {
1414
super.init(url: URL(string: "test")!)
1515
}
1616

17-
open func appendToCallbackCheckString(_ str: String) {
17+
func appendToCallbackCheckString(_ str: String) {
1818
self.callbackCheckString += str
1919
}
2020

21-
open func storeDataObjectGivenToCallback(_ data: Any) {
21+
func storeDataObjectGivenToCallback(_ data: Any) {
2222
self.objectGivenToCallback = data
2323
}
2424

25-
open func storeEventGivenToCallback(_ event: PusherEvent) {
25+
func storeEventGivenToCallback(_ event: PusherEvent) {
2626
self.eventGivenToCallback = event
2727
}
2828

29-
override open func connect() {
29+
override func connect() {
3030
let connectionEstablishedString = "{\"event\":\"pusher:connection_established\",\"data\":\"{\\\"socket_id\\\":\\\"45481.3166671\\\",\\\"activity_timeout\\\":120}\"}"
3131
_ = stubber.stub(
3232
functionName: "connect",
@@ -42,7 +42,7 @@ open class MockWebSocket: NWWebSocket {
4242
)
4343
}
4444

45-
override open func disconnect(closeCode: NWProtocolWebSocket.CloseCode = .protocolCode(.normalClosure)) {
45+
override func disconnect(closeCode: NWProtocolWebSocket.CloseCode = .protocolCode(.normalClosure)) {
4646
_ = stubber.stub(
4747
functionName: "disconnect",
4848
args: nil,
@@ -55,7 +55,7 @@ open class MockWebSocket: NWWebSocket {
5555
}
5656

5757
// swiftlint:disable:next function_body_length cyclomatic_complexity
58-
override open func send(string: String) {
58+
override func send(string: String) {
5959
if string == "{\"data\":{\"channel\":\"test-channel\"},\"event\":\"pusher:subscribe\"}" || string == "{\"event\":\"pusher:subscribe\",\"data\":{\"channel\":\"test-channel\"}}" {
6060
_ = stubber.stub(
6161
functionName: "writeString",
@@ -228,14 +228,14 @@ func stringContainsElements(_ str: String, elements: [String]) -> Bool {
228228
return allElementsPresent
229229
}
230230

231-
open class MockPusherConnection: PusherConnection {
231+
class MockPusherConnection: PusherConnection {
232232
let stubber = StubberForMocks()
233233

234234
init(options: PusherClientOptions = PusherClientOptions()) {
235235
super.init(key: "key", socket: MockWebSocket(), url: "ws://blah.blah:80", options: options)
236236
}
237237

238-
override open func handleEvent(event: PusherEvent) {
238+
override func handleEvent(event: PusherEvent) {
239239
_ = stubber.stub(
240240
functionName: "handleEvent",
241241
args: [event],
@@ -244,18 +244,18 @@ open class MockPusherConnection: PusherConnection {
244244
}
245245
}
246246

247-
open class StubberForMocks {
248-
open var calls: [FunctionCall]
249-
open var responses: [String: AnyObject]
250-
open var callbacks: [([FunctionCall]) -> Void]
247+
class StubberForMocks {
248+
var calls: [FunctionCall]
249+
var responses: [String: AnyObject]
250+
var callbacks: [([FunctionCall]) -> Void]
251251

252252
init() {
253253
self.calls = []
254254
self.responses = [:]
255255
self.callbacks = []
256256
}
257257

258-
open func stub(functionName: String, args: [Any]?, functionToCall: (() -> Void)?) -> AnyObject? {
258+
func stub(functionName: String, args: [Any]?, functionToCall: (() -> Void)?) -> AnyObject? {
259259
calls.append(FunctionCall(name: functionName, args: args))
260260
if let response: AnyObject = responses[functionName] {
261261
self.callCallbacks(calls: calls)
@@ -267,18 +267,18 @@ open class StubberForMocks {
267267
return nil
268268
}
269269

270-
open func registerCallback(callback: @escaping ([FunctionCall]) -> Void) {
270+
func registerCallback(callback: @escaping ([FunctionCall]) -> Void) {
271271
callbacks.append(callback)
272272
}
273273

274-
open func callCallbacks(calls: [FunctionCall]) {
274+
func callCallbacks(calls: [FunctionCall]) {
275275
for callback in callbacks {
276276
callback(calls)
277277
}
278278
}
279279
}
280280

281-
open class FunctionCall {
281+
class FunctionCall {
282282
let name: String
283283
let args: [Any]?
284284

Tests/Unit/Protocols/PusherConnectionDelegateTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@ import XCTest
55
class PusherConnectionDelegateTests: XCTestCase {
66
private class DummyDelegate: PusherDelegate {
77
let stubber = StubberForMocks()
8-
open var socket: MockWebSocket?
9-
open var ex: XCTestExpectation?
8+
var socket: MockWebSocket?
9+
var ex: XCTestExpectation?
1010
var testingChannelName: String?
1111

12-
open func changedConnectionState(from old: ConnectionState, to new: ConnectionState) {
12+
func changedConnectionState(from old: ConnectionState, to new: ConnectionState) {
1313
_ = stubber.stub(
1414
functionName: "connectionChange",
1515
args: [old, new],
1616
functionToCall: nil
1717
)
1818
}
1919

20-
open func debugLog(message: String) {
20+
func debugLog(message: String) {
2121
if message.range(of: "websocketDidReceiveMessage") != nil {
2222
self.socket?.appendToCallbackCheckString(message)
2323
}
2424
}
2525

26-
open func subscribedToChannel(name: String) {
26+
func subscribedToChannel(name: String) {
2727
guard let cName = testingChannelName, cName == name else {
2828
return
2929
}
3030

3131
ex!.fulfill()
3232
}
3333

34-
open func failedToSubscribeToChannel(name: String, response: URLResponse?, data: String?, error: NSError?) {
34+
func failedToSubscribeToChannel(name: String, response: URLResponse?, data: String?, error: NSError?) {
3535
guard let cName = testingChannelName, cName == name else {
3636
return
3737
}
3838

3939
ex!.fulfill()
4040
}
4141

42-
open func receivedError(error: PusherError) {
42+
func receivedError(error: PusherError) {
4343
_ = stubber.stub(
4444
functionName: "error",
4545
args: [error],

0 commit comments

Comments
 (0)