cebe / cebe/php-openapi

Should we use mock server in test?

オープン
#236 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。