function MediaTest::testNameBaseField

Same name in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testNameBaseField()
  2. 8.9.x core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testNameBaseField()
  3. 10 core/modules/media/tests/src/Kernel/MediaTest.php \Drupal\Tests\media\Kernel\MediaTest::testNameBaseField()

Tests the Media "name" base field behavior.

File

core/modules/media/tests/src/Kernel/MediaTest.php, line 28

Class

MediaTest
Tests Media.

Namespace

Drupal\Tests\media\Kernel

Code

public function testNameBaseField() : void {
    
    /** @var \Drupal\Core\Field\BaseFieldDefinition[] $field_definitions */
    $field_definitions = $this->container
        ->get('entity_field.manager')
        ->getBaseFieldDefinitions('media');
    // Ensure media name is configurable on manage display.
    $this->assertTrue($field_definitions['name']->isDisplayConfigurable('view'));
    // Ensure it is not visible by default.
    $this->assertSame($field_definitions['name']->getDisplayOptions('view'), [
        'region' => 'hidden',
    ]);
}

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