function ContextDefinitionTest::testEntityContextDefinitionAssert

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\ContextDefinitionTest::testEntityContextDefinitionAssert()
  2. 11.x core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php \Drupal\KernelTests\Core\Plugin\ContextDefinitionTest::testEntityContextDefinitionAssert()

@covers ::__construct

File

core/tests/Drupal/KernelTests/Core/Plugin/ContextDefinitionTest.php, line 54

Class

ContextDefinitionTest
@coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition @group Plugin

Namespace

Drupal\KernelTests\Core\Plugin

Code

public function testEntityContextDefinitionAssert() : void {
    $this->expectException(\AssertionError::class);
    $this->expectExceptionMessage('assert(!str_starts_with($data_type, \'entity:\') || $this instanceof EntityContextDefinition)');
    new ContextDefinition('entity:entity_test');
}

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