Should we use mock server in test?
- Dominant language
- PHP
- Stars
- 500
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with tests/spec/ReferenceTest.php, especially testResolveFileHttp, and trace the failure through src/spec/Reference.php and src/ReferenceContext.php. Determine how the fixture can avoid raw.githubusercontent.com rate limits, then run the PHPUnit test to verify it no longer depends on that external request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, php
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100