EntityDisplayTest.php

Same filename in this branch
  1. 10 core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
  2. 10 core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
Same filename in other branches
  1. 9 core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
  2. 9 core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
  3. 9 core/modules/field_ui/tests/src/Functional/EntityDisplayTest.php
  4. 8.9.x core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
  5. 8.9.x core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
  6. 8.9.x core/modules/field_ui/tests/src/Functional/EntityDisplayTest.php
  7. 11.x core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php
  8. 11.x core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
  9. 11.x core/modules/field_ui/tests/src/Functional/EntityDisplayTest.php

Namespace

Drupal\Tests\field_ui\Functional

File

core/modules/field_ui/tests/src/Functional/EntityDisplayTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\field_ui\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests the UI for entity displays.
 *
 * @group field_ui
 */
class EntityDisplayTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'field_ui',
        'entity_test',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->drupalLogin($this->drupalCreateUser([
            'administer entity_test display',
        ]));
    }
    
    /**
     * Tests the use of regions for entity view displays.
     */
    public function testEntityView() : void {
        $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());
    }

}

Classes

Title Deprecated Summary
EntityDisplayTest Tests the UI for entity displays.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.