Skip to content

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

Merged
c9s merged 2 commits into
phpbrew:masterfrom
kevinnio:use-vcr-to-record-http-interactions
Feb 28, 2019
Merged

Use php-vcr to record http interactions through all the test suite#987
c9s merged 2 commits into
phpbrew:masterfrom
kevinnio:use-vcr-to-record-http-interactions

Conversation

@kevinnio

@kevinnio kevinnio commented Oct 29, 2018

Copy link
Copy Markdown
Contributor

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

coveralls commented Oct 29, 2018

Copy link
Copy Markdown

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

kevinnio commented Nov 5, 2018

Copy link
Copy Markdown
Contributor Author

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

Comment thread tests/PhpBrew/Command/InstallCommandTest.php Outdated
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

c9s commented Jan 26, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

4 participants