Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use php-vcr to record http interactions through all the test suite #987

Merged
merged 2 commits into from
Feb 28, 2019

Conversation

kevinnio
Copy link
Contributor

@kevinnio kevinnio commented Oct 29, 2018

This is an attempt to wrap every http interaction done while testing in a VCR cassette. This is a followup to #986.

Not every single interaction can be wrapped since some of them download binary files (which can't be stored in cassettes), but this PR wraps alls interactions that can be wrapped. This will allow for faster builds and less problems related to hitting API limits, triggering anti-DDoS tools and such.

This also introduces two new phpunit group tags: noVCR and macosIncompatible. The first one is meant to be used in every test which by its own nature cannot be wrapped into a VCR cassette. These are, for example, tests where binary files are downloaded. The latter is just a treat to allow devs who use macOS to run the test suite without tests breaking due to system libraries not available on that OS.

Now we can run something like vendor/bin/phpunit --exclude-group noVCR whenever we want to run the test suite without hitting the network. We can always do a full run when needed (while in Travis, for example).

Maybe later we can figure out a way to prevent any test from actually reaching out to the Internet, but I think this is generally a step in a good direction for the project.

@kevinnio kevinnio force-pushed the use-vcr-to-record-http-interactions branch 2 times, most recently from a09017e to aa1bf96 Compare October 29, 2018 18:41
@coveralls
Copy link

coveralls commented Oct 29, 2018

Coverage Status

Coverage increased (+0.06%) to 52.584% when pulling 2ad2ce2 on kevinnio:use-vcr-to-record-http-interactions into ceb31b5 on phpbrew:master.

@kevinnio kevinnio force-pushed the use-vcr-to-record-http-interactions branch 4 times, most recently from 6fc0112 to 0f88b85 Compare November 5, 2018 04:12
@kevinnio
Copy link
Contributor Author

kevinnio commented Nov 5, 2018

@c9s, if you can take a look when you've got free time, I'd appreciate it.

This is an attempt to wrap every http interaction done while testing in a VCR cassette.
Not every single interaction can be wrapped since some of them download binary files
(which can't be stored in cassettes), but this commit wraps every interaction that
can be wrapped. This will allow for faster tests and less problems related to hitting
API limits, triggering anti-DDoS tools and such.

This also introduces two new phpunit group tags: cantVCR and macosIncompatible. The
first one is meant to be used in every test which by its own nature cannot be wrapped
into a VCR cassette. These are, for example, tests where binary files are downloaded.
The latter is just a treat to allow devs who use macOS to run the test suite without
tests breaking due to system libraries not available on that OS.

Now we can run something like vendor/bin/phpunit --exclude-group cantVCR whenever we
want to run the test suite without hitting the network. We can always do a full run
when needed.
@kevinnio kevinnio force-pushed the use-vcr-to-record-http-interactions branch from da7689e to 04df0fa Compare January 23, 2019 23:32
@c9s
Copy link
Member

c9s commented Jan 26, 2019

looks like travis-ci did not run

@kevinnio kevinnio force-pushed the use-vcr-to-record-http-interactions branch from 04df0fa to 2ad2ce2 Compare January 28, 2019 05:37
@kevinnio
Copy link
Contributor Author

Travis build fixed. Ready to merge whenever you are, @c9s.

@c9s c9s merged commit 221fc6f into phpbrew:master Feb 28, 2019
@kevinnio kevinnio deleted the use-vcr-to-record-http-interactions branch March 28, 2019 17:33
@morozov morozov added this to the Release 1.24 milestone Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants