rackbeat/laravel-client

Laravel PHP 客户端库,用于我们的API

dev-master 2022-08-01 04:40 UTC

This package is auto-updated.

Last update: 2024-08-29 05:30:41 UTC


README

**尚未准备好!**

API Laravel SDK

Build Status Coverage Total Downloads Latest Stable Version License

安装

只需使用composer即可,一切就绪!

composer require rackbeat/laravel-client

使用

即将推出...

测试

API类附带了一些模拟工具。您可以模拟响应或仅断言端点是否被调用。

断言已调用

// Set up the API class to use mocking
\Rackbeat\API::mock();

// Has not been called yet 
\Rackbeat\API::assertNotCalled( 'get', '/lots' );

// Make a API call to GET /lots
\Rackbeat\API::lots()->index();

// Has now been called
\Rackbeat\API::assertCalled( 'get', '/lots' );

模拟响应

// Set up the API class to use mocking
\Rackbeat\API::mock();
\Rackbeat\API::mockResponse('GET', '/lots', 'no lots');

// Make a API call to GET /lots
\Rackbeat\API::lots()->index();

// Assert that the response was 'no lots'
\Rackbeat\API::assertResponded( 'get', '/lots', 'no lots' );

贡献者

...

要求

  • PHP >= 7.4
  • Laravel >= 6.0