SettingsFormTest.php

Same filename in this branch
  1. 11.x core/modules/jsonapi/tests/src/Functional/SettingsFormTest.php
  2. 11.x core/modules/layout_builder/tests/src/Functional/SettingsFormTest.php
Same filename in other branches
  1. 9 core/modules/media_library/tests/src/Functional/SettingsFormTest.php
  2. 8.9.x core/modules/media_library/tests/src/Functional/SettingsFormTest.php
  3. 10 core/modules/jsonapi/tests/src/Functional/SettingsFormTest.php
  4. 10 core/modules/media_library/tests/src/Functional/SettingsFormTest.php
  5. 10 core/modules/layout_builder/tests/src/Functional/SettingsFormTest.php

Namespace

Drupal\Tests\media_library\Functional

File

core/modules/media_library/tests/src/Functional/SettingsFormTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\media_library\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests the Media Library settings form.
 *
 * @coversDefaultClass \Drupal\media_library\Form\SettingsForm
 * @group media_library
 */
class SettingsFormTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'media_library',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests the Media Library settings form.
     */
    public function testSettingsForm() : void {
        $account = $this->drupalCreateUser([
            'access administration pages',
            'administer media',
        ]);
        $this->drupalLogin($account);
        $page = $this->getSession()
            ->getPage();
        $assert_session = $this->assertSession();
        $this->drupalGet('/admin/config');
        $page->clickLink('Media Library settings');
        $page->checkField('Enable advanced UI');
        $page->pressButton('Save configuration');
        $assert_session->checkboxChecked('Enable advanced UI');
        $page->uncheckField('Enable advanced UI');
        $page->pressButton('Save configuration');
        $assert_session->checkboxNotChecked('Enable advanced UI');
    }

}

Classes

Title Deprecated Summary
SettingsFormTest Tests the Media Library settings form.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.