EntityDisplayTest.php in Drupal 8
File
core/modules/field_ui/tests/src/Functional/EntityDisplayTest.php
View source
<?php
namespace Drupal\Tests\field_ui\Functional;
use Drupal\Tests\BrowserTestBase;
class EntityDisplayTest extends BrowserTestBase {
public static $modules = [
'field_ui',
'entity_test',
];
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'administer entity_test display',
]));
}
public function testEntityView() {
$this
->drupalGet('entity_test/structure/entity_test/display');
$this
->assertSession()
->elementExists('css', '.region-content-message.region-empty');
$this
->assertTrue($this
->assertSession()
->optionExists('fields[field_test_text][region]', 'hidden')
->isSelected());
$this
->getSession()
->getPage()
->selectFieldOption('fields[field_test_text][region]', 'content');
$this
->assertTrue($this
->assertSession()
->optionExists('fields[field_test_text][region]', 'content')
->isSelected());
$this
->submitForm([], 'Save');
$this
->assertSession()
->pageTextContains('Your settings have been saved.');
$this
->assertTrue($this
->assertSession()
->optionExists('fields[field_test_text][region]', 'content')
->isSelected());
}
}