// Configure the iframe to be narrower than the actual video, so we can
// verify that the video scales correctly.
$display = \Drupal::
service('entity_display.repository'
)->
getViewDisplay('media',
$media_type_id);
$this->
assertFalse($display->
isNew());
$component =
$display->
getComponent('field_media_oembed_video'
);
$this->
assertIsArray($component);
$component['settings'
]['max_width'
] = 240;
$display->
setComponent('field_media_oembed_video',
$component);
$this->
assertSame(SAVED_UPDATED,
$display->
save());
$this->
hijackProviderEndpoints();
$video_url = 'https://vimeo.com/7073899';
ResourceController::
setResourceUrl($video_url,
$this->
getFixturesDirectory() . '/video_vimeo.json'
);
// Create a media item.
$this->
drupalGet("media/add/
$media_type_id"
);
$assert_session->
fieldExists('Remote video URL'
)->
setValue($video_url);
$assert_session->
buttonExists('Save'
)->
press();
$assert_session->
addressEquals('admin/content/media'
);
// Get the media entity view URL from the creation message.