function RelationshipManagerTest::testRelationshipPluginAvailability

Same name in other branches
  1. 8.x-3.x tests/src/Kernel/RelationshipManagerTest.php \Drupal\Tests\ctools\Kernel\RelationshipManagerTest::testRelationshipPluginAvailability()

@covers ::getDefinitionsForContexts

File

tests/src/Kernel/RelationshipManagerTest.php, line 40

Class

RelationshipManagerTest
@coversDefaultClass \Drupal\ctools\Plugin\RelationshipManager @group CTools

Namespace

Drupal\Tests\ctools\Kernel

Code

public function testRelationshipPluginAvailability() {
    $context_definition = new EntityContextDefinition('entity:node');
    $contexts = [
        'node' => new Context($context_definition, $this->entities['node1']),
    ];
    $definitions = $this->relationshipManager
        ->getDefinitionsForContexts($contexts);
    $context_definition = new EntityContextDefinition('entity:node');
    $contexts = [
        'node' => new Context($context_definition, $this->entities['node2']),
    ];
    $definitions = $this->relationshipManager
        ->getDefinitionsForContexts($contexts);
    $this->assertArrayNotHasKey('typed_data_relationship:entity:node:body', $definitions);
    $context_definition = new EntityContextDefinition('entity:node');
    $contexts = [
        'node' => new Context($context_definition, $this->entities['node3']),
    ];
    $definitions = $this->relationshipManager
        ->getDefinitionsForContexts($contexts);
}