function FilterCrudTest::testDisableFallbackFormat

Same name and namespace in other branches
  1. 9 core/modules/filter/tests/src/Kernel/FilterCrudTest.php \Drupal\Tests\filter\Kernel\FilterCrudTest::testDisableFallbackFormat()
  2. 8.9.x core/modules/filter/tests/src/Kernel/FilterCrudTest.php \Drupal\Tests\filter\Kernel\FilterCrudTest::testDisableFallbackFormat()
  3. 10 core/modules/filter/tests/src/Kernel/FilterCrudTest.php \Drupal\Tests\filter\Kernel\FilterCrudTest::testDisableFallbackFormat()

Tests disabling the fallback text format.

File

core/modules/filter/tests/src/Kernel/FilterCrudTest.php, line 78

Class

FilterCrudTest
Tests creation, loading, updating, deleting of text formats and filters.

Namespace

Drupal\Tests\filter\Kernel

Code

public function testDisableFallbackFormat() : void {
    $this->installConfig([
        'filter',
    ]);
    $message = '\\LogicException with message "The fallback text format \'plain_text\' cannot be disabled." was thrown.';
    try {
        FilterFormat::load('plain_text')->disable();
        $this->fail($message);
    } catch (\LogicException $e) {
        $this->assertSame("The fallback text format 'plain_text' cannot be disabled.", $e->getMessage(), $message);
    }
}

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