public function GalleryBundleTest::addVideoItem in D7 Media 8
Adds video type item.
1 call to GalleryBundleTest::addVideoItem()
- GalleryBundleTest::testGalleryItemThumbnail in src/
Tests/ GalleryBundleTest.php - Tests thumbnail of the gallery item.
File
- src/
Tests/ GalleryBundleTest.php, line 155
Class
- GalleryBundleTest
- Ensures that media bundle for gallery can be created.
Namespace
Drupal\media\TestsCode
public function addVideoItem() {
$edit = [
'name[0][value]' => 'Drupal video!',
'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
];
$this
->drupalPostForm('media/add/video', $edit, t('Save and publish'));
// Obtain the video id.
$media_id = $this->container
->get('entity.query')
->get('media')
->condition('bundle', 'video')
->sort('created', 'DESC')
->execute();
$media_id = reset($media_id);
$edit['id'] = $media_id;
return $edit;
}