Issue #3401764 by BramDriesen, xjm, smustgrave: Replace CollegeHumor URLs and logic in core test cases

merge-requests/5445/head
xjm 2023-11-16 12:09:54 -06:00
parent d5e0610510
commit 8087bc588d
No known key found for this signature in database
GPG Key ID: 206B0B8743BDF4C2
8 changed files with 34 additions and 40 deletions

View File

@ -170,7 +170,6 @@ cnenzrgre
codesniffer
colgroups
colinodell
collegehumor
colonpos
colour
colspans
@ -211,6 +210,7 @@ customly
customrequest
cweagans
cádiz
dailymotion
databasename
datas
datelist

View File

@ -27,19 +27,18 @@
"https:\/\/*.twitter.com\/*\/status\/*"
],
"url": "https:\/\/publish.twitter.com\/oembed"
}
]
},
{
"provider_name": "CollegeHumor",
"provider_url": "http:\/\/www.collegehumor.com\/",
"provider_name": "Dailymotion",
"provider_url": "https:\/\/www.dailymotion.com\/",
"endpoints": [
{
"schemes": [
"http:\/\/www.collegehumor.com\/video\/*"
"https:\/\/www.dailymotion.com\/video\/*"
],
"url": "http:\/\/www.collegehumor.com\/oembed.{format}",
"url": "https:\/\/www.dailymotion.com\/services\/oembed",
"discovery": true
}
]

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<link rel="alternate" href="video_collegehumor.xml"
type="application/xml+oembed" title="Let&#039;s Not Get a Drink Sometime">
</head>
<body></body>
</html>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="de">
<head>
<link rel="alternate" href="video_dailymotion.xml"
type="application/xml+oembed" title="#d8rules - Support the Rules module for Drupal 8">
</head>
<body></body>
</html>

View File

@ -2,15 +2,15 @@
<oembed>
<type>video</type>
<version>1.0</version>
<title>Let's Not Get a Drink Sometime</title>
<title>#d8rules - Support the Rules module for Drupal 8</title>
<https/>
<author_name>CollegeHumor</author_name>
<author_url>http://www.collegehumor.com</author_url>
<provider_name>CollegeHumor</provider_name>
<provider_url>http://www.collegehumor.com</provider_url>
<author_name>Leepchic</author_name>
<author_url>https://www.dailymotion.com/leepchic</author_url>
<provider_name>Dailymotion</provider_name>
<provider_url>https://www.dailymotion.com</provider_url>
<width>610</width>
<height>343</height>
<html><h1>CollegeHumor works!</h1>
<html><h1>Dailymotion works!</h1>
</html>
<!-- The thumbnail URL does not contain a file extension, so we use
this to test the oEmbed source plugin's thumbnail handling;

View File

@ -43,9 +43,9 @@ class ResourceFetcherTest extends MediaFunctionalTestBase {
'Drupal Rap Video - Schipulcon09',
],
'XML resource' => [
'video_collegehumor.xml',
'CollegeHumor',
"Let's Not Get a Drink Sometime",
'video_dailymotion.xml',
'Dailymotion',
"#d8rules - Support the Rules module for Drupal 8",
],
];
}

View File

@ -47,9 +47,9 @@ class UrlResolverTest extends MediaFunctionalTestBase {
'https://vimeo.com/14782834',
'https://vimeo.com/api/oembed.json?url=https://vimeo.com/14782834',
],
'match by endpoint: CollegeHumor' => [
'http://www.collegehumor.com/video/40002870/lets-not-get-a-drink-sometime',
'http://www.collegehumor.com/oembed.json?url=http://www.collegehumor.com/video/40002870/lets-not-get-a-drink-sometime',
'match by endpoint: Dailymotion' => [
'https://www.dailymotion.com/video/x2vzluh',
'https://www.dailymotion.com/services/oembed?url=https://www.dailymotion.com/video/x2vzluh',
],
'match by endpoint: Facebook' => [
'https://www.facebook.com/facebook/videos/10153231379946729/',
@ -106,13 +106,8 @@ class UrlResolverTest extends MediaFunctionalTestBase {
'https://vimeo.com/api/oembed.json?url=video_vimeo.html',
],
'XML resource' => [
'video_collegehumor.html',
// The endpoint does not explicitly declare that it supports XML, so
// only JSON support is assumed, which is why the discovered URL
// contains '.json'. However, the fetched HTML file contains a
// relationship to an XML representation of the resource, with the
// application/xml+oembed MIME type.
'http://www.collegehumor.com/oembed.json?url=video_collegehumor.html',
'video_dailymotion.html',
'https://www.dailymotion.com/services/oembed?url=video_dailymotion.html',
],
];
}

View File

@ -160,22 +160,22 @@ class MediaSourceOEmbedVideoTest extends MediaSourceTestBase {
// Try to create a media asset from a disallowed provider.
$this->drupalGet("media/add/$media_type_id");
$assert_session->fieldExists('Remote video URL')->setValue('http://www.collegehumor.com/video/40003213/grant-and-katie-are-starting-their-own-company');
$assert_session->fieldExists('Remote video URL')->setValue('https://www.dailymotion.com/video/x2vzluh');
$page->pressButton('Save');
$assert_session->pageTextContains('The CollegeHumor provider is not allowed.');
$assert_session->pageTextContains('The Dailymotion provider is not allowed.');
// Register a CollegeHumor video as a second oEmbed resource. Note that its
// Register a Dailymotion video as a second oEmbed resource. Note that its
// thumbnail URL does not have a file extension.
$media_type = MediaType::load($media_type_id);
$source_configuration = $media_type->getSource()->getConfiguration();
$source_configuration['providers'][] = 'CollegeHumor';
$source_configuration['providers'][] = 'Dailymotion';
$media_type->getSource()->setConfiguration($source_configuration);
$media_type->save();
$video_url = 'http://www.collegehumor.com/video/40003213/let-not-get-a-drink-sometime';
ResourceController::setResourceUrl($video_url, $this->getFixturesDirectory() . '/video_collegehumor.xml');
$video_url = 'https://www.dailymotion.com/video/x2vzluh';
ResourceController::setResourceUrl($video_url, $this->getFixturesDirectory() . '/video_dailymotion.xml');
// Create a new media item using a CollegeHumor video.
// Create a new media item using a Dailymotion video.
$this->drupalGet("media/add/$media_type_id");
$assert_session->fieldExists('Remote video URL')->setValue($video_url);
$assert_session->buttonExists('Save')->press();