module-rest icon indicating copy to clipboard operation
module-rest copied to clipboard

Rename `setServerParameters()` to `haveServerParameters()`; drop `haveServerParameter()`

Open ThomasLandauer opened this issue 5 years ago • 1 comments

Just stumbled upon this while searching for a new name for deleteHeader(), see https://github.com/Codeception/module-rest/issues/22

Current situation:

I would say:

  • "setServerParameters" isn't the right term, Codeception's convention for this is "haveServerParameters".
  • It doesn't make sense to have two functions for this, one for a single parameter, and one for multiple. If the expected argument is an array, anybody knows immediately what to pass. So the existing haveServerParameter can be deprecated in favor of the new haveServerParameters.
  • Remaining question: Is the "Symfony BrowserKit" thing more of a bug or more of a feature?
    If feature: Just pass the array along to Symfony's setServerParameters, and that's it.
    If bug: foreach() over the array and use Symfony's setServerParameter.

ThomasLandauer avatar Oct 14 '20 16:10 ThomasLandauer

Both functions also exist in lib-innerbrowser:

  • https://github.com/Codeception/lib-innerbrowser/blob/master/src/Codeception/Lib/InnerBrowser.php#L2061
  • https://github.com/Codeception/lib-innerbrowser/blob/master/src/Codeception/Lib/InnerBrowser.php#L2047

ThomasLandauer avatar Oct 14 '20 16:10 ThomasLandauer