-
Notifications
You must be signed in to change notification settings - Fork 30
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
Helper classes should not have static methods #106
Comments
to avoid a BC break, i would love to keep the static methods along with any idea for the naming? |
removed the milestone |
Running into this issue again - one solution here would be simply to make the
And so be able to unit test my class without implicitly unit testing the NodeHelper.. |
if we want to change this, making the constructor public would be a first step, and deprecating to call the methods statically. we then would need to refactor jackalope to pass around the helper. does calling static methods on an instance not raise a warning or something? |
Well, if we were to deprecate then we would also need to think about removing the first argument and making it a constructor argument. It would be a massive pain as I think everybody who uses PHPCR probably uses this method, so I would just quietly remove the __construct restriction.
... ?? |
NodeHelper
class is a utility class which implements a set of static methods. This is a problem because theSession
object is passed to some of the methods, which makes really widens the scope of unit tests.e.g.
Ultimately we should be able to use the
NodeHelper::createPath
method from an injected class, e.g.This would make unit testing classes which need to create paths much cleaner. https://github.com/symfony-cmf/RoutingAutoBundle/pull/73/files#r10602618
The text was updated successfully, but these errors were encountered: