3 namespace Drupal\Tests\video_embed_field\Functional;
5 use Drupal\Tests\BrowserTestBase;
8 * Integration test for the field configuration form.
10 * @group video_embed_field
12 class FieldConfigurationTest extends BrowserTestBase {
14 use EntityDisplaySetupTrait;
20 public static $modules = [
27 * Test the field configuration form.
29 public function testFieldConfiguration() {
30 $this->drupalLogin($this->createAdminUser());
31 $this->createContentType(['type' => 'page', 'name' => 'Page']);
32 drupal_flush_all_caches();
33 $this->drupalGet('admin/structure/types/manage/page/fields/add-field');
35 'new_storage_type' => 'video_embed_field',
36 'label' => 'Video Embed',
37 'field_name' => 'video_embed',
38 ], t('Save and continue'));
39 $this->submitForm([], t('Save field settings'));
41 'label' => 'Video Embed',
42 'description' => 'Some help.',
44 'default_value_input[field_video_embed][0][value]' => 'http://example.com',
45 'settings[allowed_providers][vimeo]' => 'vimeo',
46 'settings[allowed_providers][youtube]' => 'youtube',
47 'settings[allowed_providers][youtube_playlist]' => 'youtube_playlist',
48 ], t('Save settings'));
49 $this->assertSession()->pageTextContains('Could not find a video provider to handle the given URL.');
51 'default_value_input[field_video_embed][0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
52 ], t('Save settings'));
53 $this->assertSession()->pageTextContains('Saved Video Embed configuration.');