FormatterConfigurationTest.php in Field Redirection 8.2
File
tests/src/Functional/FormatterConfigurationTest.php
View source
<?php
namespace Drupal\Tests\field_redirection\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\field_redirection\Traits\FieldRedirectionTestTrait;
class FormatterConfigurationTest extends BrowserTestBase {
use FieldRedirectionTestTrait;
protected $defaultTheme = 'stark';
public static $modules = [
'node',
'field_ui',
'field_redirection',
];
protected $testContentType;
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this->rootUser);
$this->testContentType = $this
->setupContentTypeAndField();
}
public function testDangerMessage() {
$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');
$this
->assertSession()
->pageTextContains('Danger! The Redirect formatter should not be used with any view mode other than "Full content".');
$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');
$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');
$this
->assertSession()
->pageTextNotContains('Danger! The Redirect formatter should not be used with any view mode other than "Full content".');
}
}