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

No error given when having a conflicting helper method name when multiple modules are loaded #2627

Closed
fc opened this issue Dec 11, 2015 · 5 comments

Comments

@fc
Copy link

fc commented Dec 11, 2015

I had both the ZF1 and REST module enabled in my functional.suite.yml.

In my FunctionalTester helper class in \Helper\Functional.php I had a method called sendPOST. When calling sendPOST from my *Cest class it would execute the sendPOST in the REST module. After renaming sendPOST to something else it worked.

It's true I probably don't need to load both the ZF1/REST module at the same time (still new to this codeception thing), but even so it never triggered an error that there was a duplicate sendPOST method and led to confusion. Ideally it'll throw an exception about the duplicate methods.

@Naktibalda
Copy link
Member

Related issue: #2604

@Naktibalda
Copy link
Member

I think that this issue was overlooked earlier.

Fixing it will cause a backwards compatibility break - amHttpAuthenticated and grabAttributeFrom methods must be renamed either in REST module or in InnerBrowser.
Custom helpers could be affected too.

@fc
Copy link
Author

fc commented Dec 14, 2015

For maintaining backwards compatibility, perhaps it could at the very least throw a warning messaging but only when it is calling a method that has been marked as a duplicate. It might be a little hackish to get it to trigger that warning in the first place but I could submit a PR for that.

@Naktibalda Naktibalda added the RFC label Dec 15, 2015
@Naktibalda
Copy link
Member

@DavertMik What's your opinion about this issue?

@DavertMik
Copy link
Member

Starting from 2.2 Codeception is strict about conflicts and makes modules with possible conflicts to throw the error. However, REST+Zend are not considered to be conflictful. It is still possible to have duplicate methods in order you want to override them from helpers.

On methods mentioned by @Naktibalda:

  • grabAttributeFrom from REST is renamed to grabAttributeFromXmlElement
  • amHttpAuthenticated are both in REST and PhpBrowser but they work on the same client so there shouldn't be problems.

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

3 participants