Codeception / Codeception/module-rest

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

未关闭
#26 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
60
派生
30
平均合并
22 小时 37 分钟
30 天内合并 PR
1

描述

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`.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。