定制 minicli/pest-plugin-curly 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

minicli/pest-plugin-curly

最新稳定版本:0.3.0

Composer 安装命令:

composer require --dev minicli/pest-plugin-curly

包简介

Make curl(y) requests in Pest tests

README 文档

README

This plugin adds basic HTTP requests functionality to Pest tests, using minicli/curly.

Installation

composer require minicli/pest-plugin-curly

Usage

The plugin exposes 3 testcase methods:

  • get()
  • matchResponse(string $endpoint, int code)
  • responseContains(string $endpoint, string $needle)

Examples:

<?php

it('makes GET requests', function () {
    $this->get('https://api.github.com/rate_limit');
});

it('matches response codes', function () {
    $this->matchResponse('https://api.github.com/rate_limit', 200);
});

it('matches strings in response body', function () {
    $this->responseContains('https://api.github.com/rate_limit', 'rate');
});

It also comes with a shortcut function that you can use to have access to a Curly Client instance. That is useful if you need to check more information about requests, send special headers, or if you need to perform other types of requests supported by Curly (POST and DELETE). The documentation has more info on how to use this library.

use function Minicli\PestCurlyPlugin\curly;

it('makes requests using the curly() function to obtain response', function () {
    expect(curly()->get('https://api.github.com/rate_limit'))->toBeArray();
});

统计信息

  • 总下载量: 557
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固