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. 10 core/tests/Drupal/KernelTests/Core/Plugin/EntityContextTypedDataTest.php \Drupal\KernelTests\Core\Plugin\EntityContextTypedDataTest::testValidateConfigEntityContext()
  3. 11.x 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);
}

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