Issue #2958785 by abramm: ContextDefinition isSatisfiedBy() check fails for context using inherited class
parent
44b9b25c47
commit
e817928144
|
@ -273,7 +273,7 @@ class ContextDefinition implements ContextDefinitionInterface {
|
|||
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\Context;
|
|||
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 @@ class ContextDefinitionIsSatisfiedTest extends UnitTestCase {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?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 {}
|
Loading…
Reference in New Issue