public function FormatterConfigurationTest::testDangerMessage in Field Redirection 8.2
Tests danger message.
File
- tests/
src/ Functional/ FormatterConfigurationTest.php, line 63
Class
- FormatterConfigurationTest
- Tests the field_redirection_formatter configuration forms.
Namespace
Drupal\Tests\field_redirection\FunctionalCode
public function testDangerMessage() {
// Enable the field's output.
$this
->drupalGet('admin/structure/types/manage/' . $this->testContentType
->id() . '/display');
$this
->assertSession()
->statusCodeEquals(200);
$edit = [
'fields[url][region]' => 'content',
];
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertText('Your settings have been saved');
// Verify the 'danger' message displays correctly.
$this
->assertSession()
->pageTextContains('Danger! The Redirect formatter should not be used with any view mode other than "Full content".');
// Turn on the "full" view mode.
$this
->drupalGet('admin/structure/types/manage/' . $this->testContentType
->id() . '/display');
$this
->assertSession()
->statusCodeEquals(200);
$edit = [
'display_modes_custom[full]' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertText('Your settings have been saved');
// Make the field display.
$this
->drupalGet('admin/structure/types/manage/' . $this->testContentType
->id() . '/display/full');
$this
->assertSession()
->statusCodeEquals(200);
$edit = [
'fields[url][region]' => 'content',
];
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertText('Your settings have been saved');
// Confirm that the danger message does not display.
$this
->assertSession()
->pageTextNotContains('Danger! The Redirect formatter should not be used with any view mode other than "Full content".');
}