Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / field_ui / tests / src / Functional / EntityDisplayTest.php
1 <?php
2
3 namespace Drupal\Tests\field_ui\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests the UI for entity displays.
9  *
10  * @group field_ui
11  */
12 class EntityDisplayTest extends BrowserTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = ['field_ui', 'entity_test'];
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setUp() {
23     parent::setUp();
24
25     $this->drupalLogin($this->drupalCreateUser([
26       'administer entity_test display',
27     ]));
28   }
29
30   /**
31    * Tests the use of regions for entity view displays.
32    */
33   public function testEntityView() {
34     $this->drupalGet('entity_test/structure/entity_test/display');
35     $this->assertSession()->elementExists('css', '.region-content-message.region-empty');
36     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
37
38     $this->getSession()->getPage()->selectFieldOption('fields[field_test_text][region]', 'content');
39     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
40
41     $this->submitForm([], 'Save');
42     $this->assertSession()->pageTextContains('Your settings have been saved.');
43     $this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'content')->isSelected());
44   }
45
46 }