Unverified Commit e8179281 authored by alexpott's avatar alexpott

Issue #2958785 by abramm: ContextDefinition isSatisfiedBy() check fails for...

Issue #2958785 by abramm: ContextDefinition isSatisfiedBy() check fails for context using inherited class
parent 44b9b25c
......@@ -273,7 +273,7 @@ public function isSatisfiedBy(ContextInterface $context) {
if ($context->hasContextValue()) {
$values = [$context->getContextData()];
}
elseif ($definition instanceof static) {
elseif ($definition instanceof self) {
$values = $definition->getSampleValues();
}
else {
......
......@@ -17,6 +17,7 @@
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\TypedData\TypedDataManager;
use Drupal\Core\Validation\ConstraintManager;
use Drupal\Tests\Core\Plugin\Fixtures\InheritedContextDefinition;
use Drupal\Tests\UnitTestCase;
use Prophecy\Argument;
......@@ -196,6 +197,13 @@ public function providerTestIsSatisfiedBy() {
new ContextDefinition('entity:test_config'),
];
// Inherited context definition class.
$data['both any, inherited context requirement definition'] = [
TRUE,
new InheritedContextDefinition('any'),
new ContextDefinition('any'),
];
return $data;
}
......
<?php
namespace Drupal\Tests\Core\Plugin\Fixtures;
use Drupal\Core\Plugin\Context\ContextDefinition;
/**
* Inherited class used for testing.
*
* @see \Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest
*/
class InheritedContextDefinition extends ContextDefinition {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment