OEmbedFieldWidgetTest.php in Drupal 10
File
core/modules/media/tests/src/Functional/FieldWidget/OEmbedFieldWidgetTest.php
View source
<?php
namespace Drupal\Tests\media\Functional\FieldWidget;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\media\Functional\MediaFunctionalTestBase;
class OEmbedFieldWidgetTest extends MediaFunctionalTestBase {
protected $defaultTheme = 'stark';
public function testFieldWidgetHelpText() {
$account = $this
->drupalCreateUser([
'create media',
]);
$this
->drupalLogin($account);
$media_type = $this
->createMediaType('oembed:video');
$source_field = $media_type
->getSource()
->getSourceFieldDefinition($media_type)
->getName();
$field = FieldConfig::loadByName('media', $media_type
->id(), $source_field);
$field
->setDescription('This is help text for oEmbed field.')
->save();
$this
->drupalGet('media/add/' . $media_type
->id());
$assert_session = $this
->assertSession();
$assert_session
->pageTextContains('This is help text for oEmbed field.');
$assert_session
->pageTextContains('You can link to media from the following services: YouTube, Vimeo');
}
}