All Projects → blastcloud → hybrid

blastcloud / hybrid

Licence: MIT license
Power up your app or SDK with a testing library specifically for Symfony/HttpClient

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to hybrid

Http Api Invoker
一个让http接口调用跟调用本地方法一样自然优雅的项目
Stars: ✭ 147 (+241.86%)
Mutual labels:  httpclient
Httpclient Android
HttpClient repackaged for Android
Stars: ✭ 211 (+390.7%)
Mutual labels:  httpclient
angular-httpclient
Angular 15 Example HttpClient
Stars: ✭ 21 (-51.16%)
Mutual labels:  httpclient
Curlsharp
CurlSharp - .Net binding and object-oriented wrapper for libcurl.
Stars: ✭ 153 (+255.81%)
Mutual labels:  httpclient
Httplug
HTTPlug, the HTTP client abstraction for PHP
Stars: ✭ 2,295 (+5237.21%)
Mutual labels:  httpclient
rawhttp
Raw HTTP client in Go for complete request control and customization.
Stars: ✭ 100 (+132.56%)
Mutual labels:  httpclient
Httptracer
Stars: ✭ 142 (+230.23%)
Mutual labels:  httpclient
grapevine
Fast, unopinionated, embeddable, minimalist web framework for .NET
Stars: ✭ 72 (+67.44%)
Mutual labels:  httpclient
Yurunhttp
YurunHttp 是开源的 PHP HTTP 客户端,支持链式操作,简单易用。完美支持Curl、Swoole 协程。QQ群:17916227
Stars: ✭ 197 (+358.14%)
Mutual labels:  httpclient
smart-api-framework
smart api automation framework to support web service api automaton test based on testng and httpclient
Stars: ✭ 15 (-65.12%)
Mutual labels:  httpclient
Tiny.restclient
Simpliest Fluent REST client for .NET
Stars: ✭ 158 (+267.44%)
Mutual labels:  httpclient
Book118 Downloader
基于java的book118文档下载器
Stars: ✭ 187 (+334.88%)
Mutual labels:  httpclient
HttpClientMock
Library for mocking Apache HttpClient.
Stars: ✭ 41 (-4.65%)
Mutual labels:  httpclient
Heimdall
An enhanced HTTP client for Go
Stars: ✭ 2,132 (+4858.14%)
Mutual labels:  httpclient
simple-http
抽取一个简单 HTTP 的通用接口,底层实现根据具体引入依赖指定。
Stars: ✭ 38 (-11.63%)
Mutual labels:  httpclient
Funiture
慕课网课程推荐 Java并发编程与高并发解决方案:http://coding.imooc.com/class/195.html Java开发企业级权限管理系统:http://coding.imooc.com/class/149.html github: https://github.com/kanwangzjm/funiture, spring项目,权限管理、系统监控、定时任务动态调整、qps限制、sql监控(邮件)、验证码服务、短链接服务、动态配置等
Stars: ✭ 1,786 (+4053.49%)
Mutual labels:  httpclient
Angular11 App
Angular 11 ,Bootstrap 5, Node.js, Express.js, CRUD REST API, PWA, SSR, SEO, Angular Universal, Lazy Loading, PostgreSQL, MYSQL
Stars: ✭ 233 (+441.86%)
Mutual labels:  httpclient
ng-crm
A Simple Angular 6 CRM (CRUD Example)
Stars: ✭ 50 (+16.28%)
Mutual labels:  httpclient
FluentRest
Lightweight fluent wrapper over HttpClient to make REST calls easier
Stars: ✭ 54 (+25.58%)
Mutual labels:  httpclient
esa-httpclient
An asynchronous event-driven HTTP client based on netty.
Stars: ✭ 82 (+90.7%)
Mutual labels:  httpclient


Full Documentation at hybrid.guzzler.dev

Charge up your app or SDK with a testing library specifically for Symfony/HttpClient.

Installation

composer require --dev --prefer-dist blastcloud/hybrid

Example Usage

<?php

use BlastCloud\Hybrid\{Expectation, UsesHybrid};
use Symfony\Component\HttpClient\Response\MockResponse;
use PHPUnit\Framework\TestCase;

class SomeTest extends TestCase
{
    use UsesHybrid;

    public $classToTest;

    public function setUp(): void
    {
        parent::setUp();
    
        $client = $this->hybrid->getClient([
            /* Any configs for a client */
            "base_uri" => "https://example.com/api"
        ]);
        
        // You can then inject this client object into your code or IOC container.
        $this->classToTest = new ClassToTest($client);
    }

    public function testSomethingWithExpectations()
    {
        $this->hybrid->expects($this->once())
            ->post("/some-url")
            ->withHeader("X-Authorization", "some-key")
            ->willRespond(new MockResponse("Some body"));
    
        $this->classToTest->someMethod();
    }

    public function testSomethingWithAssertions()
    {
        $this->hybrid->queueResponse(
            new MockResponse(null, ['http_code' => 204]),
            new \Exception("Some message"),
            // any needed responses to return from the client.
        );
    
        $this->classToTest->someMethod();
        // ... Some other number of calls
    
        $this->hybrid->assertAll(function (Expectation $expect) {
            return $expect->withHeader("Authorization", "some-key");
        });
    }
}

Documentation

Full Documentation

License

Hybrid is open-source software licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].