Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants