Codeception / Codeception/module-rest
Rename `setServerParameters()` to `haveServerParameters()`; drop `haveServerParameter()`
- Vorherrschende Sprache
- PHP
- Sterne
- 60
- Forks
- 30
- Ø Merge
- 22 Std. 37 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
Just stumbled upon this while searching for a new name for `deleteHeader()`, see https://github.com/Codeception/module-rest/issues/22
Current situation:
* [`haveServerParameter('name', 'value')`](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Module/REST.php#L1629) uses Symfony's [`Client::setServerParameter()`](https://github.com/symfony/browser-kit/blob/4.4/Client.php#L145)
* [`setServerParameters([])`](https://github.com/Codeception/module-rest/blob/master/src/Codeception/Module/REST.php#L1617) uses Symfony's [`Client::setServerParameters()`](https://github.com/symfony/browser-kit/blob/4.4/Client.php#L132) which sets `'HTTP_USER_AGENT' => 'Symfony BrowserKit'` by default.
I would say:
* "*set*ServerParameters" isn't the right term, Codeception's convention for this is "**have**ServerParameters".
* 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`.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne in src/Codeception/Module/REST.php bei etwa den Zeilen 1617 und 1629 und vergleiche anschließend das Verhalten von setServerParameters() und setServerParameter() im verlinkten Symfony BrowserKit. Kläre, ob der Standard-User-Agent beibehalten werden sollte, und überprüfe das endgültige Benennungs-, Deprecation- und Parameterbehandlungsverhalten anhand der Anforderungen des Issues.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php, symfony
- Bereich
- api
- Issue-Typ
- Refactoring
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 28/100