function EntityContextTypedDataTest::testValidateConfigEntityContext

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php \Drupal\KernelTests\Core\Plugin\EntityContextTypedDataTest::testValidateConfigEntityContext()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php \Drupal\KernelTests\Core\Plugin\EntityContextTypedDataTest::testValidateConfigEntityContext()
  3. 10 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 26

Class

EntityContextTypedDataTest
Tests the interaction between entity context and typed data.

Namespace

Drupal\KernelTests\Core\Plugin

Code

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

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