cebe / cebe/php-openapi

Should we use mock server in test?

Đang mở
#236 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PHP
Star
500
Fork
99
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với tests/spec/ReferenceTest.php, đặc biệt là testResolveFileHttp, và lần theo lỗi qua src/spec/Reference.php và src/ReferenceContext.php. Xác định cách fixture có thể tránh các giới hạn tốc độ của raw.githubusercontent.com, sau đó chạy bài kiểm thử PHPUnit để xác minh rằng nó không còn phụ thuộc vào yêu cầu bên ngoài đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
openapi, php
Lĩnh vực
testing-qa
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.