You are here

public function RequestQueryArgumentResolverTest::resolveProvider in Organic groups 8

Data provider for testResolve().

See also

::testResolve()

File

tests/src/Unit/Plugin/OgGroupResolver/RequestQueryArgumentResolverTest.php, line 183

Class

RequestQueryArgumentResolverTest
Tests the RequestQueryArgumentResolver plugin.

Namespace

Drupal\Tests\og\Unit\Plugin\OgGroupResolver

Code

public function resolveProvider() {
  return [
    // Test that no group is added on a path that does not have a query
    // argument.
    [
      // There is no query argument for the entity ID.
      NULL,
      // There is no query argument for the bundle ID.
      NULL,
      // A group was added by another plugin.
      [
        'group-0',
      ],
      // But this plugin should not add any group since there is no query
      // argument.
      NULL,
    ],
    // Test that no group is added on a path that has an invalid entity type
    // in the query arguments.
    [
      'parmigiano-reggiano',
      'group-0',
      [
        'group-0',
      ],
      NULL,
    ],
    // Test that no groups are added on a path that has a missing entity type.
    [
      NULL,
      'group-0',
      [
        'group-0',
      ],
      NULL,
    ],
    // Test that no groups are added on a path that has an invalid entity ID.
    [
      'node',
      // Group 1 is a taxonomy term, this ID is invalid for groups of type
      // node.
      'group-1',
      [
        'group-1',
      ],
      NULL,
    ],
    // Test that no groups are added on a path that has a missing entity ID.
    [
      'node',
      NULL,
      [
        'group-0',
      ],
      NULL,
    ],
    // Test that a vote can be added for a group that is present on the query
    // argument and has been previously added by another plugin.
    [
      'node',
      'group-0',
      [
        'group-0',
      ],
      'group-0',
    ],
    // Test that a vote can be added for a group of a different entity type
    // that is present on the query argument and has been previously added by
    // another plugin.
    [
      'taxonomy_term',
      'group-1',
      [
        'group-1',
      ],
      'group-1',
    ],
    // Test that a vote can be added for a group that is present on the query
    // argument and is part of multiple groups that have been added by other
    // plugins.
    [
      'node',
      'group-0',
      [
        'group-0',
        'group-1',
      ],
      'group-0',
    ],
    // Test that a vote can not be added for a group that is present on the
    // query argument but has not been previously added by another plugin. We
    // do not want users to be able to fake a group context by messing with
    // the query arguments.
    [
      'node',
      'group-0',
      [
        'group-1',
      ],
      NULL,
    ],
    // Test that a vote can not be added for a group content entity that is
    // present on the query argument.
    [
      'entity_test',
      'group_content',
      [
        'group-0',
      ],
      NULL,
    ],
    // Test that a vote can not be added for an entity that is present on the
    // query argument but is neither a group nor group content.
    [
      'entity_test',
      'non_group',
      [
        'group-0',
        'group-1',
      ],
      NULL,
    ],
  ];
}