You are here

public function RevisionUiAccessTest::viewAccessProvider in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/RevisionUiAccessTest.php \Drupal\Tests\group\Kernel\RevisionUiAccessTest::viewAccessProvider()

Data provider for testViewAccess().

Return value

array A list of testViewAccess method arguments.

File

tests/src/Kernel/RevisionUiAccessTest.php, line 240

Class

RevisionUiAccessTest
Tests the revision UI access for groups.

Namespace

Drupal\Tests\group\Kernel

Code

public function viewAccessProvider() {
  $cases = [];
  $cases['view-one-rev-no-new-rev'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    'Checking access to published revision viewing when there is one revision and new revisions are not created automatically',
  ];
  $cases['view-one-rev-new-rev'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    'Checking access to published revision viewing when there is one revision and new revisions are created automatically',
  ];
  $cases['view-multi-rev-no-new-rev-default'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    'Checking access to default published revision viewing when there are multiple revisions and new revisions are not created automatically',
  ];
  $cases['view-multi-rev-new-rev-default'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    'Checking access to default published revision viewing when there are multiple revisions and new revisions are created automatically',
  ];
  $cases['view-multi-rev-no-new-rev-non-default'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    FALSE,
    TRUE,
    TRUE,
    'Checking access to non-default published revision viewing when there are multiple revisions and new revisions are not created automatically',
  ];
  $cases['view-multi-rev-new-rev-non-default'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE,
    'Checking access to non-default published revision viewing when there are multiple revisions and new revisions are created automatically',
  ];
  $cases['no-view-one-rev-new-rev-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    'Checking access to default published revision viewing when there is one revision and new revisions are created automatically, but the user has no view access',
  ];
  $cases['no-view-multi-rev-new-rev-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    'Checking access to default published revision viewing when there are multiple revisions and new revisions are created automatically, but the user has no view access',
  ];
  $cases['no-view-one-rev-new-rev-non-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    'Checking access to non-default published revision viewing when there is one revision and new revisions are created automatically, but the user has no view access',
  ];
  $cases['no-view-multi-rev-new-rev-non-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE,
    'Checking access to non-default published revision viewing when there are multiple revisions and new revisions are created automatically, but the user has no view access',
  ];
  $cases['view-unpub-one-rev-no-new-rev'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    'Checking access to unpublished revision viewing when there is one revision and new revisions are not created automatically',
  ];
  $cases['view-unpub-one-rev-new-rev'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    'Checking access to unpublished revision viewing when there is one revision and new revisions are created automatically',
  ];
  $cases['view-unpub-multi-rev-no-new-rev-default'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    'Checking access to default unpublished revision viewing when there are multiple revisions and new revisions are not created automatically',
  ];
  $cases['view-unpub-multi-rev-new-rev-default'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    'Checking access to default unpublished revision viewing when there are multiple revisions and new revisions are created automatically',
  ];
  $cases['view-unpub-multi-rev-no-new-rev-non-default'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    FALSE,
    FALSE,
    FALSE,
    'Checking access to non-default unpublished revision viewing when there are multiple revisions and new revisions are not created automatically',
  ];
  $cases['view-unpub-multi-rev-new-rev-non-default'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    FALSE,
    'Checking access to non-default unpublished revision viewing when there are multiple revisions and new revisions are created automatically',
  ];
  $cases['no-view-unpub-one-rev-new-rev-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    FALSE,
    FALSE,
    'Checking access to default unpublished revision viewing when there is one revision and new revisions are created automatically, but the user has no view access',
  ];
  $cases['no-view-unpub-multi-rev-new-rev-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    'Checking access to default unpublished revision viewing when there are multiple revisions and new revisions are created automatically, but the user has no view access',
  ];
  $cases['no-view-unpub-one-rev-new-rev-non-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    FALSE,
    FALSE,
    'Checking access to non-default unpublished revision viewing when there is one revision and new revisions are created automatically, but the user has no view access',
  ];
  $cases['no-view-unpub-multi-rev-new-rev-non-default'] = [
    [],
    [
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    FALSE,
    'Checking access to non-default unpublished revision viewing when there are multiple revisions and new revisions are created automatically, but the user has no view access',
  ];

  // Mixed revisions are where the original one is unpublished and the default
  // one is published. This proves you need both 'view published' and 'view
  // unpublished' access.
  $cases['view-mixed-default'] = [
    [
      'view group',
      'view any unpublished group',
    ],
    [
      'view group',
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    'Checking access to default mixed revision viewing',
  ];
  $cases['view-mixed-non-default'] = [
    [
      'view group',
      'view any unpublished group',
    ],
    [
      'view group',
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    TRUE,
    'Checking access to non-default mixed revision viewing',
  ];
  $cases['no-view-mixed-default'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    'Checking access to default mixed revision viewing when the user has no view access',
  ];
  $cases['no-view-mixed-non-default'] = [
    [
      'view any unpublished group',
    ],
    [
      'view any unpublished group',
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    TRUE,
    'Checking access to non-default mixed revision viewing when the user has no view access',
  ];
  $cases['no-view-unpub-mixed-default'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    'Checking access to default mixed revision viewing when the user has no view unpublished access',
  ];
  $cases['no-view-unpub-mixed-non-default'] = [
    [
      'view group',
    ],
    [
      'view group',
      'view group revisions',
    ],
    FALSE,
    FALSE,
    TRUE,
    TRUE,
    TRUE,
    FALSE,
    FALSE,
    TRUE,
    'Checking access to non-default mixed revision viewing when the user has no view unpublished access',
  ];
  return $cases;
}