public function EntityContextDefinitionDeprecationTest::testIsSatisfiedBy in Drupal 8
Test that isSatisfiedBy() calls the compatibility layer.
@covers ::isSatisfiedBy @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 177
Class
- EntityContextDefinitionDeprecationTest
- Test deprecated use of ContextDefinition as an EntityContextDefinition.
Namespace
Drupal\Tests\Core\Plugin\ContextCode
public function testIsSatisfiedBy() {
// Ensure that the BC object's getSampleValues() method is called during
// validation.
$bc_mock = $this
->getMockBuilder(EntityContextDefinition::class)
->setMethods([
'getSampleValues',
])
->getMock();
$bc_mock
->expects($this
->atLeastOnce())
->method('getSampleValues')
->willReturn([]);
$this->compatibilityLayer
->setValue($this->definition, $bc_mock);
$this->definition
->isSatisfiedBy(new Context($this->definition));
}