drom-test / comment-client
该软件包最新版本(1.0)没有提供许可信息。
1.0
2024-07-21 10:08 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.9
- psr/http-client: ^1.0
- psr/http-message: ^2.0
Requires (Dev)
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2024-09-21 18:26:22 UTC
README
任务2
需要实现一个针对抽象(虚构)评论服务 "example.com" 的客户端。该项目应代表一个或多个类,这些类将执行对服务器的 HTTP 请求。输出应是一个可以连接到任何其他项目的库。该服务有 3 个方法:GET http://example.com/comments - 返回评论列表 POST http://example.com/comment - 添加评论。PUT http://example.com/comment/{id} - 根据评论 ID 更新请求中的字段。comment 对象包含以下字段:id - 类型 int。添加时无需指定。name - 类型 string。text - 类型 string。编写 phpunit 测试,以检查客户端的可行性。不需要编写 example.com 服务器的代码!只需编写与之交互的库。
安装
composer require drom-test/comment-client
使用
要使用客户端,应调用 CommentClient
类
测试
composer test