-
- // Add another field and change the configured media field.
- $this->drupalGet('admin/structure/media/manage/video_bundle/fields/add-field');
- $this->submitForm([
- 'new_storage_type' => 'video_embed_field',
- 'label' => 'New Video Field',
- 'field_name' => 'new_video_field',
- ], 'Save and continue');
- $this->submitForm([], t('Save field settings'));
- $this->submitForm([], t('Save settings'));
-
- // Update video source field.
- $this->drupalGet('admin/structure/media/manage/video_bundle');
- $this->submitForm([
- 'type_configuration[video_embed_field][source_field]' => 'field_new_video_field',
- ], t('Save media bundle'));
-
- // Create a video, populating both video URL fields.
- $this->drupalGet('media/add/video_bundle');
- $this->submitForm([
- 'name[0][value]' => 'Another Video!',
- 'field_media_video_embed_field[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
- 'field_new_video_field[0][value]' => 'https://www.youtube.com/watch?v=gnERPdAiuSo',
- ], t('Save'));
-
- // We should see the newly configured video thumbnail, but not the original.
- $this->assertContains('video_thumbnails/gnERPdAiuSo.jpg', $this->getSession()->getPage()->getHtml());
- $this->assertNotContains('video_thumbnails/XgYu7-DQjDQ.jpg', $this->getSession()->getPage()->getHtml());