function FilterDefaultConfigTest::testInstallation
Same name in other branches
- 9 core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php \Drupal\Tests\filter\Kernel\FilterDefaultConfigTest::testInstallation()
- 8.9.x core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php \Drupal\Tests\filter\Kernel\FilterDefaultConfigTest::testInstallation()
- 10 core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php \Drupal\Tests\filter\Kernel\FilterDefaultConfigTest::testInstallation()
Tests installation of default formats.
File
-
core/
modules/ filter/ tests/ src/ Kernel/ FilterDefaultConfigTest.php, line 38
Class
- FilterDefaultConfigTest
- Tests text format default configuration.
Namespace
Drupal\Tests\filter\KernelCode
public function testInstallation() : void {
// Verify that the format was installed correctly.
$format = FilterFormat::load('filter_test');
$this->assertTrue((bool) $format);
$this->assertEquals('filter_test', $format->id());
$this->assertEquals('Test format', $format->label());
$this->assertEquals(2, $format->get('weight'));
// Verify that format default property values have been added/injected.
$this->assertNotEmpty($format->uuid());
// Verify that the loaded format does not contain any roles.
$this->assertNull($format->get('roles'));
// Verify that the defined roles in the default config have been processed.
$this->assertEquals([
RoleInterface::ANONYMOUS_ID,
RoleInterface::AUTHENTICATED_ID,
], array_keys(filter_get_roles_by_format($format)));
// Verify enabled filters.
$filters = $format->get('filters');
$this->assertEquals(1, $filters['filter_html_escape']['status']);
$this->assertEquals(-10, $filters['filter_html_escape']['weight']);
$this->assertEquals('filter', $filters['filter_html_escape']['provider']);
$this->assertEquals([], $filters['filter_html_escape']['settings']);
$this->assertEquals(1, $filters['filter_autop']['status']);
$this->assertEquals(0, $filters['filter_autop']['weight']);
$this->assertEquals('filter', $filters['filter_autop']['provider']);
$this->assertEquals([], $filters['filter_autop']['settings']);
$this->assertEquals(1, $filters['filter_url']['status']);
$this->assertEquals(0, $filters['filter_url']['weight']);
$this->assertEquals('filter', $filters['filter_url']['provider']);
$this->assertEquals([
'filter_url_length' => 72,
], $filters['filter_url']['settings']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.