You are here

public function UserGroupAccessResolverTest::resolveProvider in Organic groups 8

Data provider for testResolve().

See also

::testResolve()

File

tests/src/Unit/Plugin/OgGroupResolver/UserGroupAccessResolverTest.php, line 134

Class

UserGroupAccessResolverTest
Tests the UserGroupAccessResolver plugin.

Namespace

Drupal\Tests\og\Unit\Plugin\OgGroupResolver

Code

public function resolveProvider() {
  return [
    // Test that the groups to which the user does not have access are removed
    // from a collection that has both accessible and non-accessible groups.
    // The accessible groups should get a vote added, so that the 'user' cache
    // context is correctly set on it.
    [
      // We start with a collection that has a mix of accessible and non-
      // accessible groups.
      [
        'group-access-0',
        'group-access-1',
        'group-noaccess-0',
        'group-noaccess-1',
      ],
      // A vote should be added to the accessible groups.
      [
        'group-access-0',
        'group-access-1',
      ],
      // The non-accessible groups should be removed.
      [
        'group-noaccess-0',
        'group-noaccess-1',
      ],
    ],
    // Test that no groups are removed when the collection does not contain
    // any non-accessible groups.
    [
      [
        'group-access-0',
        'group-access-1',
      ],
      [
        'group-access-0',
        'group-access-1',
      ],
      [],
    ],
    // Test that no votes are added when the collection does not contain any
    // accessible groups. The non-accessible ones should be removed.
    [
      [
        'group-noaccess-0',
        'group-noaccess-1',
      ],
      [],
      [
        'group-noaccess-0',
        'group-noaccess-1',
      ],
    ],
    // Test that nothing happens on an empty collection.
    [
      [],
      [],
      [],
    ],
  ];
}