You are here

public function EntityContextTypedDataTest::testValidateConfigEntityContext in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php \Drupal\KernelTests\Core\Plugin\EntityContextTypedDataTest::testValidateConfigEntityContext()

Tests that entity contexts wrapping a config entity can be validated.

File

core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php, line 24

Class

EntityContextTypedDataTest
Tests the interaction between entity context and typed data.

Namespace

Drupal\KernelTests\Core\Plugin

Code

public function testValidateConfigEntityContext() {
  $display = EntityViewDisplay::create([
    'targetEntityType' => 'entity_test',
    'bundle' => 'entity_test',
    'mode' => 'default',
    'status' => TRUE,
  ]);
  $display
    ->save();
  $violations = EntityContext::fromEntity($display)
    ->validate();
  $this
    ->assertCount(0, $violations);
}