MakeAWishFoundation / SwiftyMocky

Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.04k stars 106 forks source link

Can't mock protocols that are restricted to specific class adoption #331

Open mapierce opened 1 year ago

mapierce commented 1 year ago

If I have a protocol like so:

// sourcery: AutoMockable
// sourcery: typealias = "ContentType = NSObject"
protocol CellContentView: UIView {

    associatedtype ContentType

    init(content: ContentType)

}

I can't mock it because I get the error in my Mock.swift file:

'CellContentView' requires that 'CellContentViewMock' inherit from 'UIView'

and the declaration of the CellContentViewMock looks like this:

open class CellContentViewMock: CellContentView, Mock {