function EntityContextDefinitionDeprecationTest::testGetConstraintObjects
Test that getConstraintObjects() adds the EntityType constraint.
@covers ::getConstraintObjects @expectedDeprecation Constructing a ContextDefinition object for an entity type is deprecated in Drupal 8.6.0. Use Drupal\Core\Plugin\Context\EntityContextDefinition instead. See https://www.drupal.org/node/2976400 for more information.
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ Context/ EntityContextDefinitionDeprecationTest.php, line 197
Class
- EntityContextDefinitionDeprecationTest
- Test deprecated use of ContextDefinition as an EntityContextDefinition.
Namespace
Drupal\Tests\Core\Plugin\ContextCode
public function testGetConstraintObjects() {
$reflector = new \ReflectionObject($this->definition);
$method = $reflector->getMethod('getConstraintObjects');
$method->setAccessible(TRUE);
$this->assertArrayHasKey('EntityType', $method->invoke($this->definition));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.