function EntityStateChangeValidationTest::transitionAccessValidationTestCases
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/EntityStateChangeValidationTest.php \Drupal\Tests\content_moderation\Kernel\EntityStateChangeValidationTest::transitionAccessValidationTestCases()
- 8.9.x core/modules/content_moderation/tests/src/Kernel/EntityStateChangeValidationTest.php \Drupal\Tests\content_moderation\Kernel\EntityStateChangeValidationTest::transitionAccessValidationTestCases()
- 10 core/modules/content_moderation/tests/src/Kernel/EntityStateChangeValidationTest.php \Drupal\Tests\content_moderation\Kernel\EntityStateChangeValidationTest::transitionAccessValidationTestCases()
Test cases for ::testTransitionAccessValidation.
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ EntityStateChangeValidationTest.php, line 377
Class
- EntityStateChangeValidationTest
- @coversDefaultClass \Drupal\content_moderation\Plugin\Validation\Constraint\ModerationStateConstraintValidator @group content_moderation
Namespace
Drupal\Tests\content_moderation\KernelCode
public static function transitionAccessValidationTestCases() {
return [
'Invalid transition, no permissions validated' => [
[],
'archived',
[
'Invalid state transition from Draft to Archived',
],
],
'Valid transition, missing permission' => [
[],
'published',
[
'You do not have access to transition from Draft to Published',
],
],
'Valid transition, granted published permission' => [
[
'use editorial transition publish',
],
'published',
[],
],
'Valid transition, granted draft permission' => [
[
'use editorial transition create_new_draft',
],
'draft',
[],
],
'Valid transition, incorrect permission granted' => [
[
'use editorial transition create_new_draft',
],
'published',
[
'You do not have access to transition from Draft to Published',
],
],
// Test with an additional state and set of transitions, since the
// "published" transition can start from either "draft" or "published", it
// does not capture bugs that fail to correctly distinguish the initial
// workflow state from the set state of a new entity.
'Valid transition, granted foo permission' => [
[
'use editorial transition draft_to_foo',
],
'foo',
[],
],
'Valid transition, incorrect foo permission granted' => [
[
'use editorial transition foo_to_foo',
],
'foo',
[
'You do not have access to transition from Draft to Foo',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.