libresign/behat-builtin-extension
Composer 安装命令:
composer require libresign/behat-builtin-extension
包简介
Behat extension to run php built-in web server
README 文档
README
Extension to use built-in PHP server on Behat tests
Instalation
composer require libresign/behat-builtin-extension vendor/bin/behat --init
Configuration
Add the extension to your behat.yml:
default: extensions: PhpBuiltin\Server: verbose: false rootDir: /var/www/html host: localhost
Config values
| config | default | Environment | Description |
|---|---|---|---|
| verbose | false | BEHAT_VERBOSE | Enables/disables verbose mode |
| rootDir | /var/www/html | BEHAT_ROOT_DIR | Specifies http root dir |
| host | localhost | BEHAT_HOST | Host domain or IP |
| runAs | BEHAT_RUN_AS | The username to be used to run the built-in server | |
| workers | 0 | BEHAT_WORKERS | The quantity of workers to use. More informations here searching by PHP_CLI_SERVER_WORKERS |
You can also use -v option to enable verbose mode. Example
vendor/bin/behat -v
The verbose mode will show:
- The rootDir used
- The output of PHP Built-in server
Usage example
<?php use Behat\Behat\Context\Context; use PhpBuiltin\RunServerListener; /** * Defines application features from the specific context. */ class FeatureContext implements Context { private string $baseUrl; public function __construct() { $this->baseUrl = RunServerListener::getServerRoot(); } public function sendRequest(string $verb, string $url, ?array $body = null, array $headers = []): void { $client = new Client(); $fullUrl = $this->baseUrl . ltrim($url, '/'); $options['headers'] = $headers; if (is_array($body)) { $options['form_params'] = $body; } try { $this->response = $client->{$verb}($fullUrl, $options); } catch (ClientException $e) { $this->response = $e->getResponse(); } catch (ServerException $e) { $this->response = $e->getResponse(); } } }
libresign/behat-builtin-extension 适用场景与选型建议
libresign/behat-builtin-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 62.49k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 libresign/behat-builtin-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 libresign/behat-builtin-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 62.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0
- 更新时间: 2022-02-21