SettingsFormTest.php

Same filename in this branch
  1. 11.x core/modules/media_library/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\jsonapi\Functional

File

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

View source
<?php

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

use Drupal\Tests\BrowserTestBase;

/**
 * @covers \Drupal\jsonapi\Form\JsonApiSettingsForm
 * @group jsonapi
 */
class SettingsFormTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'jsonapi',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests the JSON:API settings form.
     */
    public function testSettingsForm() : void {
        $account = $this->drupalCreateUser([
            'administer site configuration',
        ]);
        $this->drupalLogin($account);
        $this->drupalGet('/admin/config/services/jsonapi');
        $page = $this->getSession()
            ->getPage();
        $page->selectFieldOption('read_only', 'rw');
        $page->pressButton('Save configuration');
        $assert_session = $this->assertSession();
        $assert_session->pageTextContains('The configuration options have been saved.');
        $assert_session->fieldValueEquals('read_only', 'rw');
        $page->selectFieldOption('read_only', 'r');
        $page->pressButton('Save configuration');
        $assert_session->fieldValueEquals('read_only', 'r');
        $assert_session->pageTextContains('The configuration options have been saved.');
    }

}

Classes

Title Deprecated Summary
SettingsFormTest @covers \Drupal\jsonapi\Form\JsonApiSettingsForm @group jsonapi

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