
| Current Path : /var/www/html/rocksensor1/web/core/modules/media/tests/src/Functional/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/media/tests/src/Functional/MediaSettingsTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\media\Functional;
use Drupal\Core\Url;
/**
* Testing the media settings.
*
* @group media
*/
class MediaSettingsTest extends MediaFunctionalTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->drupalLogin($this->createUser([
'administer site configuration',
'administer media',
]));
}
/**
* Tests that the media settings form stores a `null` iFrame domain.
*/
public function testSettingsForm(): void {
$assert_session = $this->assertSession();
$this->assertNull($this->config('media.settings')->get('iframe_domain'));
$this->drupalGet(Url::fromRoute('media.settings'));
$assert_session->fieldExists('iframe_domain');
// Explicitly submitting an empty string does not result in the
// `iframe_domain` property getting set to the empty string: it is converted
// to `null` to comply with the config schema.
// @see \Drupal\media\Form\MediaSettingsForm::submitForm()
$this->submitForm([
'iframe_domain' => '',
], 'Save configuration');
$assert_session->statusMessageContains('The configuration options have been saved.', 'status');
$this->assertNull($this->config('media.settings')->get('iframe_domain'));
}
}