public function LatestRevisionCheckTest::accessSituationProvider in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php \Drupal\Tests\content_moderation\Unit\LatestRevisionCheckTest::accessSituationProvider()
Data provider for testLastAccessPermissions().
File
- core/
modules/ content_moderation/ tests/ src/ Unit/ LatestRevisionCheckTest.php, line 106
Class
- LatestRevisionCheckTest
- @coversDefaultClass \Drupal\content_moderation\Access\LatestRevisionCheck @group content_moderation
Namespace
Drupal\Tests\content_moderation\UnitCode
public function accessSituationProvider() {
return [
// Node with global permissions and latest version.
[
Node::class,
'node',
TRUE,
[
'view latest version',
'view any unpublished content',
],
FALSE,
AccessResultAllowed::class,
],
// Node with global permissions and no latest version.
[
Node::class,
'node',
FALSE,
[
'view latest version',
'view any unpublished content',
],
FALSE,
AccessResultForbidden::class,
],
// Node with own content permissions and latest version.
[
Node::class,
'node',
TRUE,
[
'view latest version',
'view own unpublished content',
],
TRUE,
AccessResultAllowed::class,
],
// Node with own content permissions and no latest version.
[
Node::class,
'node',
FALSE,
[
'view latest version',
'view own unpublished content',
],
FALSE,
AccessResultForbidden::class,
],
// Node with own content permissions and latest version, but no perms to
// view latest version.
[
Node::class,
'node',
TRUE,
[
'view own unpublished content',
],
TRUE,
AccessResultNeutral::class,
],
// Node with own content permissions and no latest version, but no perms
// to view latest version.
[
Node::class,
'node',
TRUE,
[
'view own unpublished content',
],
FALSE,
AccessResultNeutral::class,
],
// Block with pending revision, and permissions to view any.
[
BlockContent::class,
'block_content',
TRUE,
[
'view latest version',
'view any unpublished content',
],
FALSE,
AccessResultAllowed::class,
],
// Block with no pending revision.
[
BlockContent::class,
'block_content',
FALSE,
[
'view latest version',
'view any unpublished content',
],
FALSE,
AccessResultForbidden::class,
],
// Block with pending revision, but no permission to view any.
[
BlockContent::class,
'block_content',
TRUE,
[
'view latest version',
'view own unpublished content',
],
FALSE,
AccessResultNeutral::class,
],
// Block with no pending revision.
[
BlockContent::class,
'block_content',
FALSE,
[
'view latest version',
'view own unpublished content',
],
FALSE,
AccessResultForbidden::class,
],
];
}