You are here

public function LinkProviderTest::pluginDefinitionTemplates in JSON:API Hypermedia 8

Gets an array of templates from which to configure test plugins.

Return value

array The plugin definition templates.

File

tests/src/Functional/LinkProviderTest.php, line 195

Class

LinkProviderTest
Class LinkProviderTest.

Namespace

Drupal\Tests\jsonapi_hypermedia\Functional

Code

public function pluginDefinitionTemplates() {
  return [
    'all top-level links' => [
      [
        'link_context' => [
          'top_level_object' => TRUE,
        ],
        'location' => 'links',
      ],
    ],
    'top-level links; only on the entrypoint' => [
      [
        'link_context' => [
          'top_level_object' => 'entrypoint',
        ],
        'location' => 'links',
        'presence' => [
          'entrypoint',
        ],
      ],
    ],
    'top-level links; only on successful documents' => [
      [
        'link_context' => [
          'top_level_object' => 'success',
        ],
        'location' => 'links',
        'presence' => [
          'entrypoint',
          'collection',
          'individual',
          'relationship',
          'related',
        ],
      ],
    ],
    'top-level links; only on error documents' => [
      [
        'link_context' => [
          'top_level_object' => 'error',
        ],
        'location' => 'links',
        'presence' => [
          'error',
        ],
      ],
    ],
    'top-level links; only on individual documents' => [
      [
        'link_context' => [
          'top_level_object' => 'individual',
        ],
        'location' => 'links',
        'presence' => [
          'individual',
        ],
      ],
    ],
    'top-level links; only on collection documents' => [
      [
        'link_context' => [
          'top_level_object' => 'collection',
        ],
        'location' => 'links',
        'presence' => [
          'collection',
        ],
      ],
    ],
    'top-level links; only on relationship documents' => [
      [
        'link_context' => [
          'top_level_object' => 'relationship',
        ],
        'location' => 'links',
        'presence' => [
          'relationship',
        ],
      ],
    ],
    'resource object links on individual documents' => [
      [
        'link_context' => [
          'resource_object' => TRUE,
        ],
        'location' => 'data.links',
        'presence' => [
          'individual',
        ],
      ],
    ],
    'resource object links on collection documents' => [
      [
        'link_context' => [
          'resource_object' => TRUE,
        ],
        'location' => 'data.0.links',
        'presence' => [
          'collection',
        ],
      ],
    ],
    'only article resource objects on individual documents' => [
      [
        'link_context' => [
          'resource_object' => 'node--article',
        ],
        'location' => 'data.links',
        'presence' => [
          'individual',
        ],
      ],
    ],
    'only article resource objects on collection documents' => [
      [
        'link_context' => [
          'resource_object' => 'node--article',
        ],
        'location' => 'data.0.links',
        'presence' => [
          'collection',
        ],
      ],
    ],
    'relationship objects on individual documents' => [
      [
        'link_context' => [
          'relationship_object' => TRUE,
        ],
        'location' => 'data.relationships.uid.links',
        'presence' => [
          'individual',
        ],
      ],
    ],
    'relationship objects on collection documents' => [
      [
        'link_context' => [
          'relationship_object' => TRUE,
        ],
        'location' => 'data.0.relationships.uid.links',
        'presence' => [
          'collection',
        ],
      ],
    ],
    'relationship objects on relationship documents' => [
      [
        'link_context' => [
          'relationship_object' => TRUE,
        ],
        'location' => 'links',
        'presence' => [
          'relationship',
        ],
      ],
    ],
    'article author relationship objects on individual documents' => [
      [
        'link_context' => [
          'relationship_object' => [
            'node--article',
            'uid',
          ],
        ],
        'location' => 'data.relationships.uid.links',
        'presence' => [
          'individual',
        ],
      ],
    ],
    'article bundle relationship objects on individual documents' => [
      [
        'link_context' => [
          'relationship_object' => [
            'node--article',
            'uid',
          ],
        ],
        'location' => 'data.relationships.node_type.links',
        'presence' => [],
      ],
    ],
    'article author relationship objects on collection documents' => [
      [
        'link_context' => [
          'relationship_object' => [
            'node--article',
            'uid',
          ],
        ],
        'location' => 'data.0.relationships.uid.links',
        'presence' => [
          'collection',
        ],
      ],
    ],
    'article bundle relationship objects on collection documents' => [
      [
        'link_context' => [
          'relationship_object' => [
            'node--article',
            'uid',
          ],
        ],
        'location' => 'data.0.relationships.node_type.links',
        'presence' => [],
      ],
    ],
    'article author relationship objects on relationship documents' => [
      [
        'link_context' => [
          'relationship_object' => [
            'node--article',
            'uid',
          ],
        ],
        'location' => 'links',
        'presence' => [
          'relationship',
        ],
      ],
    ],
  ];
}