public function ConfigFormTest::testHtmlTitleConfigForm in HTML Title 8
Tests the HTML Title config form.
File
- tests/
src/ Functional/ ConfigFormTest.php, line 52
Class
- ConfigFormTest
- Tests the HTML Title config form.
Namespace
Drupal\Tests\html_title\FunctionalCode
public function testHtmlTitleConfigForm() {
// Check default config.
$config = $this
->config('html_title.settings');
$this
->assertEquals('<br> <sub> <sup>', $config
->get('allow_html_tags'));
// Unauthorized user should not have access.
$this
->drupalGet(Url::fromRoute('html_title.settings'));
$this
->assertSession()
->statusCodeEquals(403);
// Login as a regular user.
$this
->drupalLogin($this->webUser);
// Unauthorized user should not have access.
$this
->drupalGet(Url::fromRoute('html_title.settings'));
$this
->assertSession()
->statusCodeEquals(403);
// Login as an admin user.
$this
->drupalLogin($this->adminUser);
// Update HTML Title config.
$this
->drupalGet(Url::fromRoute('html_title.settings'));
$this
->assertSession()
->statusCodeEquals(200);
$this
->submitForm([
'allow_html_tags' => '<br>',
], 'Save configuration');
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
// Check if config is updated.
$config = $this
->config('html_title.settings');
$this
->assertEquals('<br>', $config
->get('allow_html_tags'));
}