Skip to content

Commit e547d7f

Browse files
committed
updated tests
1 parent 10c8b45 commit e547d7f

File tree

187 files changed

+22027
-25550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+22027
-25550
lines changed

tests/DocumentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testMultipleSelectors()
4444
$extractor = self::getEmbed()->get('https://css-tricks.com/css-scrollbar-with-progress-meter/');
4545
$document = $extractor->getDocument();
4646

47-
$expected = 126;
47+
$expected = 113;
4848

4949
$this->assertCount($expected, $document->selectCss('[aria-hidden],[hidden],meta,style,canvas,svg,form,script,template,link,.hidden')->nodes());
5050
$this->assertCount($expected, $document->select('.//*[@aria-hidden]|.//*[@hidden]|.//meta|.//style|.//canvas|.//svg|.//form|.//script|.//template|.//link|.//*[contains(concat(" ",normalize-space(@class)," ")," hidden ")]')->nodes());

tests/FileClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Psr\Http\Message\ResponseFactoryInterface;
1212
use Psr\Http\Message\ResponseInterface;
1313
use Psr\Http\Message\UriInterface;
14+
use Exception;
1415

1516
/**
1617
* Decorator to cache requests into files
@@ -39,8 +40,10 @@ public function sendRequest(RequestInterface $request): ResponseInterface
3940
$uri = $request->getUri();
4041
$filename = $this->path.'/'.self::getFilename($uri);
4142

42-
if ($this->mode === 0 && is_file($filename)) {
43+
if ($this->mode < 1 && is_file($filename)) {
4344
$response = $this->readResponse($filename);
45+
} elseif ($this->mode === -1) {
46+
throw new Exception("New unexpected request to {$uri}");
4447
} else {
4548
$response = $this->client->sendRequest($request);
4649
}

tests/PagesTest.php

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,48 @@ class PagesTest extends PagesTestCase
1818
*/
1919
const FIXTURES = 0;
2020

21-
public function testPages()
22-
{
23-
$this->assertEmbed('https://www.abanca.com/gl');
24-
$this->assertEmbed('https://animoto.com/play/GjsJ1gu0WDRfr4pGw12xZQ');
25-
$this->assertEmbed('http://live.amcharts.com/czNjJ');
26-
$this->assertEmbed('https://www.aol.com/video/view/pile-of-recovering-foster-kittens-is-purrfect/595fe75985eb42109b69bedb/');
27-
$this->assertEmbed('http://jeanjean.bandcamp.com/track/coquin-l-l-phant');
28-
$this->assertEmbed('http://chirb.it/7A9L9B');
29-
$this->assertEmbed('http://codepen.io/Zhouzi/pen/JoRazP');
30-
$this->assertEmbed('http://www.dailymotion.com/video/xy0wd');
31-
$this->assertEmbed('http://www.deviantart.com/art/Misty-510056679');
32-
$this->assertEmbed('http://pachunka.deviantart.com/art/Cope-145564099');
33-
$this->assertEmbed('http://www.hookem.com/story/texas-shortstop-joe-baker-arrested-public-intoxication/');
34-
$this->assertEmbed('http://i.imgur.com/X6rkCc5.jpg');
35-
$this->assertEmbed('https://infogr.am/7743c36a-f3ca-4465-9a80-a8abbd5d8dc4');
36-
$this->assertEmbed('http://output.jsbin.com/vonesu/10');
37-
$this->assertEmbed('http://jsfiddle.net/zhm5rjnz/');
38-
$this->assertEmbed('https://www.kickstarter.com/projects/1452363698/good-seed-craft-veggie-burgers');
39-
$this->assertEmbed('http://www.23hq.com/Zzleeper/photo/16600737');
40-
$this->assertEmbed('https://500px.com/photo/138251239/taganay-park-by-daniel-kordan');
41-
$this->assertEmbed('https://pastebin.com/d4biUtRm');
42-
$this->assertEmbed('http://media.photobucket.com/user/Ignwar/media/Album%20Deserts/MoonriseMonumentValleyUtah.jpg.html?filters[term]=sunsets&filters[primary]=images');
43-
$this->assertEmbed('http://www.politico.com/story/2013/12/presidents-barack-obama-george-w-bush-second-term-101314.html');
44-
$this->assertEmbed('http://polldaddy.com/poll/7012505/');
45-
$this->assertEmbed('https://www.reddit.com/r/investing/comments/7pfpeq/buffett_on_cyrptocurrencies_i_can_say_almost_with/');
46-
$this->assertEmbed('http://www.scribd.com/doc/110799637/Synthesis-of-Knowledge-Effects-of-Fire-and-Thinning-Treatments-on-Understory-Vegetation-in-Dry-U-S-Forests');
47-
$this->assertEmbed('http://www.spreaker.com/user/angelclark/angel-clark-ice-cream-tocos');
48-
$this->assertEmbed('http://www.ted.com/talks/george_monbiot_for_more_wonder_rewild_the_world?language=en#t-689901');
49-
$this->assertEmbed('http://he-who-photographs-rather-ok.tumblr.com/post/165326273724');
50-
$this->assertEmbed('http://www.ustream.tv/channel/red-shoes-billiards-60803-camera-1');
51-
$this->assertEmbed('http://www.viddler.com/v/bdce8c7');
52-
$this->assertEmbed('http://www.wired.com/?p=2064839');
21+
public function urlDataProvider(): array
22+
{
23+
return [
24+
['https://www.abanca.com/gl'],
25+
['https://animoto.com/play/GjsJ1gu0WDRfr4pGw12xZQ'],
26+
['http://live.amcharts.com/czNjJ'],
27+
['https://www.aol.com/video/view/pile-of-recovering-foster-kittens-is-purrfect/595fe75985eb42109b69bedb/'],
28+
['http://jeanjean.bandcamp.com/track/coquin-l-l-phant'],
29+
['http://chirb.it/7A9L9B'],
30+
['http://codepen.io/Zhouzi/pen/JoRazP'],
31+
['http://www.dailymotion.com/video/xy0wd'],
32+
['http://www.deviantart.com/art/Misty-510056679'],
33+
['http://pachunka.deviantart.com/art/Cope-145564099'],
34+
['http://www.hookem.com/story/texas-shortstop-joe-baker-arrested-public-intoxication/'],
35+
['http://i.imgur.com/X6rkCc5.jpg'],
36+
['https://infogr.am/7743c36a-f3ca-4465-9a80-a8abbd5d8dc4'],
37+
['http://output.jsbin.com/vonesu/10'],
38+
['http://jsfiddle.net/zhm5rjnz/'],
39+
['https://www.kickstarter.com/projects/1452363698/good-seed-craft-veggie-burgers'],
40+
['http://www.23hq.com/Zzleeper/photo/16600737'],
41+
['https://500px.com/photo/138251239/taganay-park-by-daniel-kordan'],
42+
['https://pastebin.com/d4biUtRm'],
43+
['http://media.photobucket.com/user/Ignwar/media/Album%20Deserts/MoonriseMonumentValleyUtah.jpg.html?filters[term]=sunsets&filters[primary]=images'],
44+
['http://www.politico.com/story/2013/12/presidents-barack-obama-george-w-bush-second-term-101314.html'],
45+
['http://polldaddy.com/poll/7012505/'],
46+
['https://www.reddit.com/r/investing/comments/7pfpeq/buffett_on_cyrptocurrencies_i_can_say_almost_with/'],
47+
['http://www.scribd.com/doc/110799637/Synthesis-of-Knowledge-Effects-of-Fire-and-Thinning-Treatments-on-Understory-Vegetation-in-Dry-U-S-Forests'],
48+
['http://www.spreaker.com/user/angelclark/angel-clark-ice-cream-tocos'],
49+
['http://www.ted.com/talks/george_monbiot_for_more_wonder_rewild_the_world?language=en#t-689901'],
50+
['http://he-who-photographs-rather-ok.tumblr.com/post/165326273724'],
51+
['http://www.ustream.tv/channel/red-shoes-billiards-60803-camera-1'],
52+
['http://www.viddler.com/v/bdce8c7'],
53+
['http://www.wired.com/?p=2064839'],
54+
];
55+
}
56+
57+
/**
58+
* @dataProvider urlDataProvider
59+
*/
60+
public function testPages(string $url)
61+
{
62+
$this->assertEmbed($url);
5363
}
5464

5565
public function testImageFile()

tests/cache/500px.com.photo-138251239-taganay-park-by-daniel-kordan.php

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

tests/cache/animoto.com.oembeds-create.json.416acbaec2e9fc6d8914b6044b652aad.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@
2222
'default-src \'self\' https:; base-uri \'self\'; block-all-mixed-content; child-src \'self\' https: blob:; connect-src \'self\' wss: https: blob:; font-src \'self\' data: https:; form-action \'self\' forms.hsforms.com www.facebook.com; frame-ancestors \'self\' app.optimizely.com *.eventbrite.com video214.com animoto.com; img-src \'self\' data: https: blob: android-webview-video-poster:; manifest-src \'self\'; media-src \'self\' https: data: blob:; object-src \'self\' www.paypalobjects.com d150hyw1dtprld.cloudfront.net; prefetch-src \'self\' https:; script-src \'self\' https: data: \'unsafe-inline\' \'unsafe-eval\'; style-src \'self\' https: \'unsafe-inline\'; upgrade-insecure-requests; worker-src \'self\' blob:; report-uri https://sentry.io/api/1401029/security/?sentry_key=b94ac67e5c014425a0fe8cb868528601'
2323
],
2424
'date' => [
25-
'Wed, 23 Sep 2020 21:45:56 GMT'
25+
'Sun, 04 Apr 2021 15:21:42 GMT'
2626
],
2727
'etag' => [
28-
'W/"12a9440e0e747216a434a15b6e65f5b3"'
28+
'W/"5b8e1a3b7ef622367472f865b6dcf16d"'
2929
],
3030
'referrer-policy' => [
3131
'origin-when-cross-origin'
3232
],
33+
'set-cookie' => [
34+
'__ld_hash_key=fjRF3YCKjoAmkTUi54%2FDbhpC3HY4I6hytTT8m8%2BMp40%3D; path=/; secure; SameSite=Lax',
35+
'uuid=bb5e259cb796046635288d6d7a7e771e; domain=.animoto.com; path=/; expires=Fri, 04 Apr 2031 15:21:42 -0000; secure; HttpOnly; SameSite=Lax',
36+
'_animoto.com_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiJTBhZGE0M2Q1MWM1ZWI5Yzc4YWJkMGNkMmM4MzI4M2Q0BjsAVEkiDnVzZXJfcGxhbgY7AEZJIgx2aXNpdG9yBjsAVEkiEWNvdW50cnlfY29kZQY7AEZJIgdFUwY7AFQ%3D--24b9f920e95f77bda4fff0c1a65bdae124966c12; path=/; secure; HttpOnly; SameSite=Lax'
37+
],
3338
'strict-transport-security' => [
3439
'max-age=2592000'
3540
],
@@ -43,7 +48,7 @@
4348
'web2-http.production.svc.cluster.local:8000/*'
4449
],
4550
'x-envoy-upstream-service-time' => [
46-
'216'
51+
'263'
4752
],
4853
'x-frame-options' => [
4954
'ALLOW-FROM https://app.optimizely.com'
@@ -52,10 +57,10 @@
5257
'none'
5358
],
5459
'x-request-id' => [
55-
'5e35dcff1766ad5c2e7f1260490f2706'
60+
'05b30c1210f7a595a07d4ffb7133ae55'
5661
],
5762
'x-runtime' => [
58-
'0.215120'
63+
'0.261467'
5964
],
6065
'x-served-by' => [
6166
'nginx-ingress-controller-68b4bf9c-7sdbh'
@@ -67,22 +72,22 @@
6772
'Miss from cloudfront'
6873
],
6974
'via' => [
70-
'1.1 9d2dddf4e5a6eb0fbe872acf3cba5889.cloudfront.net (CloudFront)'
75+
'1.1 40f375a15596f8d7b418a9c5dccce3d3.cloudfront.net (CloudFront)'
7176
],
7277
'x-amz-cf-pop' => [
73-
'MAD50-C1'
78+
'MAD51-C1'
7479
],
7580
'x-amz-cf-id' => [
76-
'mZHDLm5jVyuog8uYVIyIq3qQf2ayk7a0TAxKz0hu3XGUMK5KI0j1og=='
81+
'zU4_lRS3BnOXChw4CIzxRlWQ1N3LL2AyHW6nJCuRGBc1OZedMMc0Tw=='
7782
],
7883
'Content-Location' => [
7984
'https://animoto.com/oembeds/create.json?automated=true&options=start_hq&url=https%3A%2F%2Fanimoto.com%2Fplay%2FGjsJ1gu0WDRfr4pGw12xZQ'
8085
],
8186
'X-Request-Time' => [
82-
'0.724 ms'
87+
'0.873 ms'
8388
]
8489
],
8590
'statusCode' => 200,
8691
'reasonPhrase' => 'OK',
87-
'body' => '{"version":1.0,"provider_name":"Animoto","provider_url":"https://animoto.com/","type":"video","author_name":null,"title":"taco bell","description":"","thumbnail_url":"https://d2m23yiuv18ohn.cloudfront.net/Video/GjsJ1gu0WDRfr4pGw12xZQ/cover_648x360.jpg","thumbnail_height":360,"thumbnail_width":648,"icon_url":"https://d2m23yiuv18ohn.cloudfront.net/Video/GjsJ1gu0WDRfr4pGw12xZQ/cover_224x126.jpg","icon_height":54,"icon_width":54,"width":640,"height":360,"cache_age":604800,"video_url":"https://d150hyw1dtprld.cloudfront.net/swf/w.swf?w=swf/production/vp1&e=1600897556&f=GjsJ1gu0WDRfr4pGw12xZQ&d=0&m=p&r=360p&i=m&asset_domain=s3-p.animoto.com&animoto_domain=animoto.com&options=start_hq","html":"<iframe id=\\"vp1GjsJ1\\" title=\\"Video Player\\" width=\\"640\\" height=\\"360\\" frameborder=\\"0\\" src=\\"https://s3.amazonaws.com/embed.animoto.com/play.html?w=swf/production/vp1&e=1600897556&f=GjsJ1gu0WDRfr4pGw12xZQ&d=0&m=p&r=360p&i=m&asset_domain=s3-p.animoto.com&animoto_domain=animoto.com&options=start_hq\\" allowfullscreen></iframe>"}'
92+
'body' => '{"version":1.0,"provider_name":"Animoto","provider_url":"https://animoto.com/","type":"video","author_name":null,"title":"taco bell","description":"","thumbnail_url":"https://d2m23yiuv18ohn.cloudfront.net/Video/GjsJ1gu0WDRfr4pGw12xZQ/cover_648x360.jpg","thumbnail_height":360,"thumbnail_width":648,"icon_url":"https://d2m23yiuv18ohn.cloudfront.net/Video/GjsJ1gu0WDRfr4pGw12xZQ/cover_224x126.jpg","icon_height":54,"icon_width":54,"width":640,"height":360,"cache_age":604800,"video_url":"https://d150hyw1dtprld.cloudfront.net/swf/w.swf?w=swf/production/vp1&e=1617549702&f=GjsJ1gu0WDRfr4pGw12xZQ&d=0&m=p&r=360p&i=m&asset_domain=s3-p.animoto.com&animoto_domain=animoto.com&options=start_hq","html":"<iframe id=\\"vp1GjsJ1\\" title=\\"Video Player\\" width=\\"640\\" height=\\"360\\" frameborder=\\"0\\" src=\\"https://s3.amazonaws.com/embed.animoto.com/play.html?w=swf/production/vp1&e=1617549702&f=GjsJ1gu0WDRfr4pGw12xZQ&d=0&m=p&r=360p&i=m&asset_domain=s3-p.animoto.com&animoto_domain=animoto.com&options=start_hq\\" allowfullscreen></iframe>"}'
8893
];

0 commit comments

Comments
 (0)