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.03k stars 104 forks source link

Method cannot be declared open because its parameter uses an internal type #315

Closed m7mdra closed 2 years ago

m7mdra commented 2 years ago

Hello

I'm using latest version of the library 4.1.0

everything went smoothly until i tried to use mock i get this error

Method cannot be declared open because its parameter uses an internal type

marking mocked protocol and classes as public resolve the issue but i don't know if is intended to work this way its a bug

swiftymocky doctor

✅  XCode project found at: /Users/user12/Desktop/project1/project1.xcodeproj

1. Inspecting tools dependencies:
  ✅  Mint available
  ✅  Sourcery is available through Mint
  ⚠️  Mint does not yet have matching Sourcery version installed.
  Required Sourcery version would be installed upon first generation. It might take a bit more time

2. Inspecting Mockfile:
  ✅  Mockfile exists
  ✅  Mockfile contains mocks definitions

3. Linting 'project1Tests' mock:
  ✅  Output file exists
  Targets:
  ✅  Mock defines targets correctly
  ✅  All targets include './project1Tests/Mock.generated.swift' file.
  Sources:
  ✅  Sources are defined correctly
  Imports:
  ✅  Testable imports are defined
  ✅  Imports are defined

it shows a warning Mint does not yet have matching Sourcery version installed. but i dont it is relevant to my problem

thanks in advance.

spaluchiewicz commented 2 years ago

@m7mdra could you please switch to brew:

README is pending update to include this: https://github.com/MakeAWishFoundation/SwiftyMocky/pull/320

m7mdra commented 2 years ago

Thank you, i found a solution long time ago but forgot to close the issue, thanks again.

VilemKurz commented 1 year ago

I got the same problem, @m7mdra what was your solution?

m7mdra commented 1 year ago

hey @VilemKurz , it was a long time ago since i worked on that project where i encountered the issue. maybe if you could show me part of your code where the issue occur... maybe i can help.

maybe also try to follow @spaluchiewicz comment.

VilemKurz commented 1 year ago

I tried to reinstall using brew, same issue. To reproduce the problem

  1. have internal protocol, with method/properties which use internal types in their signature, marked as mockable
  2. generate mocks
  3. bug: the generated method is public. But types in its signature are internal. Thus, xcode spits the error - title of this issue.
m7mdra commented 1 year ago

@VilemKurz OK i will try to reproduce the problem and cross compare it with my project.