Opened 9 years ago
Closed 7 years ago
#32360 closed enhancement (maybelater)
Add oEmbed provider unit tests
Reported by: | johnbillion | Owned by: | johnbillion |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Embeds | Keywords: | needs-patch |
Focuses: | Cc: |
Description
A unit test should be added which tests each of our supported oEmbed providers to make sure that each provider returns the expected response.
Ideally the tests would be in their own group which is excluded from a default test run, in the same way AJAX tests work. The tests should test the HTTP response code and the validity of the JSON and XML endpoints where appropriate.
Attachments (3)
Change History (24)
#2
@
9 years ago
Thanks voldemortensen. If you need media URLs for any of the providers, #28507 should have one for each.
#3
@
9 years ago
- Component changed from Build/Test Tools to Embeds
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 4.4
32360.patch introduces tests for the responses returned by each of our oEmbed providers. The tests which actually request the oEmbed for each of the test URLs is in the external-oembed
group which doesn't run by default (these can be run with the --group=oembed
or --group=external-oembed
CLI option).
Currently missing from the tests:
- Test URL(s) for
poll.fm
. - Test URL(s) for
video214.com
. - Test URL(s) for
gi*.photobucket.com
(*cough* #28379 *cough*).
Currently failing:
scribd.com
is missing thewidth
attribute.polldaddy.com
is missing thewidth
attribute.meetup.com
returns an incorrectcontent-type
header.animoto.com
returns an incorrectcontent-type
header.tumblr.com
doesn't respect themaxwidth
parameter for itswidth
attribute.cloudup.com
doesn't respect themaxwidth
parameter for itsthumbnail_width
attribute.reverbnation.com
doesn't adhere to the oEmbed specification (see #33207).
#4
@
9 years ago
Other things I'd like to test:
- Check the correct URL scheme is used in the response when
https
URLs are requested. - Check invalid
maxwidth
andmaxheight
parameters are handled correctly (background: 29126#comment:9). - Check HTTPS support? (See #28507)
#6
@
9 years ago
- Keywords ongoing added
- Milestone changed from 4.4 to Future Release
Latest patch, 32360.2.patch, tests everything I want to cover. Twelve failures. Bleugh.
#10
@
8 years ago
@wonderboymusic @johnbillion Did you intend for the grunt task to be commented out? If so, why add it?
#11
@
8 years ago
- Keywords needs-patch added; has-patch removed
The testOembedTestsCoverAllProviders()
test has been altered from my patch and now doesn't work as intended. It should fail when a new provider is added to WP_oEmbed->providers
, which it doesn't.
#13
@
8 years ago
So the reason these tests hadn't gone into core up until this point is because there are so many failures with the external providers.
The tests are quite volatile too (I can see at least two tested URLs which are 404ing that previously weren't), for example Kickstarter is sending me 429 Too Many Requests
responses, and Cloudup is sending me 502 Bad Gateway
intermittently.
I guess it makes sense for the tests to remain in a group which never gets tested by default (ie. without passing the --group external-oembed
flag), but then I'm not sure if that's super valuable.
In addition, the testOembedProviderReturnsExpectedResponse()
test really needs to be split into several smaller tests so that every assertion can be performed (as opposed to the test failing at the first assertion failure). This means moving the actual HTTP requests into a data provider.
#15
@
8 years ago
I guess it makes sense for the tests to remain in a group which never gets tested by default (ie. without passing the --group external-oembed flag), but then I'm not sure if that's super valuable.
I just ran into this, because the <exclude><group>external-oembed</group></exclude>
added to phpunit.xml.dist wasn't automatically picked up by my custom phpunit.xml.
I definitely think it's wise to have tests for this stuff, and I think it's smart for them not to run by default. But if they're failing on a regular and predictable basis, then they shouldn't be in core (or perhaps they should be commented out in the dataProvider while the details are ironed out).
I'll start working on this tomorrow.