Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / ctools / tests / src / Kernel / RelationshipManagerTest.php
1 <?php
2
3 namespace Drupal\Tests\ctools\Kernel;
4
5 use Drupal\Core\Plugin\Context\Context;
6 use Drupal\Core\Plugin\Context\ContextDefinition;
7
8 /**
9  * @coversDefaultClass \Drupal\ctools\Plugin\RelationshipManagerInterface
10  * @group CTools
11  */
12 class RelationshipManagerTest extends RelationshipsTestBase {
13
14   /**
15    * @covers ::getDefinitions
16    */
17   public function testRelationshipConstraints() {
18     $definitions = $this->relationshipManager->getDefinitions();
19     $expected = [
20       'Bundle' => [
21         0 => "page",
22         1 => "foo"
23       ]
24     ];
25     $this->assertSame($expected, $definitions['typed_data_relationship:entity:node:body']['context']['base']->getConstraints());
26
27     // Check that typed data primitive labels are formatted properly.
28     $this->assertSame('Body from Page and Foo', (string) $definitions['typed_data_relationship:entity:node:body']['label']);
29
30     // Check that entity relationship labels are formatted properly.
31     $this->assertSame('Authored by Entity from Content', (string) $definitions['typed_data_entity_relationship:entity:node:uid']['label']);
32
33     // Check that language relationship labels are formatted properly.
34     $this->assertSame('Language Language from Content', (string) $definitions['typed_data_language_relationship:entity:node:langcode']['label']);
35   }
36
37   /**
38    * @covers ::getDefinitionsForContexts
39    */
40   public function testRelationshipPluginAvailability() {
41     $context_definition = new ContextDefinition('entity:node');
42     $contexts = [
43       'node' => new Context($context_definition, $this->entities['node1']),
44     ];
45     $definitions = $this->relationshipManager->getDefinitionsForContexts($contexts);
46     //$this->assertTrue(isset($definitions['typed_data_relationship:entity:node:body']));
47
48     $context_definition = new ContextDefinition('entity:node');
49     $contexts = [
50       'node' => new Context($context_definition, $this->entities['node2']),
51     ];
52     $definitions = $this->relationshipManager->getDefinitionsForContexts($contexts);
53     $this->assertFalse(isset($definitions['typed_data_relationship:entity:node:body']));
54
55     $context_definition = new ContextDefinition('entity:node');
56     $contexts = [
57       'node' => new Context($context_definition, $this->entities['node3']),
58     ];
59     $definitions = $this->relationshipManager->getDefinitionsForContexts($contexts);
60     //$this->assertTrue(isset($definitions['typed_data_relationship:entity:node:body']));
61   }
62
63 }