Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static approach makes this class unmockable #9

Open
func0der opened this issue Jul 3, 2017 · 3 comments
Open

Static approach makes this class unmockable #9

func0der opened this issue Jul 3, 2017 · 3 comments

Comments

@func0der
Copy link

func0der commented Jul 3, 2017

Hey there,

I found that you class seems to be unmockable for PHPUnit, because all its calls are static and the state is saved staticalled, too.

I could imagine, why you would have chosen this approach, but it hinders us from mocking it away.

Do you see a way of combining a 'correct' stateful approach with your easy accessible static one? Maybe with the singleton pattern for example?
With this approach there would be almost to none changes to your existing public api, because you could hide the instanciating process in your class.
Or maybe something else, like a new major with a compatibility break?

@mathiasgrimm
Copy link
Owner

mathiasgrimm commented Jul 3, 2017 via email

@func0der
Copy link
Author

func0der commented Jul 3, 2017

Of what I am trying to test or how I would imagine your class in the non-static approach?

@mathiasgrimm
Copy link
Owner

mathiasgrimm commented Jul 3, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants