cebe / cebe/php-openapi

Should we use mock server in test?

未关闭
#236 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
500
派生
99
PR 合并指标
30 天内没有已合并 PR

描述

I got these errors while running tests via PHPUnit locally.

```
2) ReferenceTest::testResolveFileHttp
cebe\openapi\exceptions\UnresolvableReferenceException: Failed to resolve Reference 'definitions.yaml#/Pet' to cebe\openapi\spec\Schema Object: file_get_contents(https://raw.githubusercontent.com/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/definitions.yaml): failed to open stream: HTTP request failed! HTTP/1.1 429 Too Many Requests

/app/src/spec/Reference.php:226
/app/src/SpecBaseObject.php:416
/app/src/SpecBaseObject.php:412
/app/tests/spec/ReferenceTest.php:247
phpvfscomposer:///app/vendor/phpunit/phpunit/phpunit:106

Caused by
PHPUnit\Framework\Error\Warning: file_get_contents(https://raw.githubusercontent.com/cebe/php-openapi/290389bbd337cf4d70ecedfd3a3d886715e19552/tests/spec/data/reference/definitions.yaml): failed to open stream: HTTP request failed! HTTP/1.1 429 Too Many Requests

/app/src/ReferenceContext.php:217
/app/src/spec/Reference.php:224
/app/src/SpecBaseObject.php:416
/app/src/SpecBaseObject.php:412
/app/tests/spec/ReferenceTest.php:247
phpvfscomposer:///app/vendor/phpunit/phpunit/phpunit:106

```

Should we use mock server to fix this issue?

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 tests/spec/ReferenceTest.php 开始,尤其是 testResolveFileHttp,并通过 src/spec/Reference.php 和 src/ReferenceContext.php 追踪故障。确定 fixture 如何避免 raw.githubusercontent.com 的速率限制,然后运行 PHPUnit 测试,以验证它不再依赖该外部请求。

由索引模型根据 Issue 内容生成。

评估

技术栈
openapi, php
领域
testing-qa
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。