You are here

public function StateTransitionValidationTest::userTransitionsProvider in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/StateTransitionValidationTest.php \Drupal\Tests\workbench_moderation\Unit\StateTransitionValidationTest::userTransitionsProvider()

Data provider for the user transition test.

Return value

array Returns an array.

File

tests/src/Unit/StateTransitionValidationTest.php, line 212

Class

StateTransitionValidationTest
@coversDefaultClass \Drupal\workbench_moderation\StateTransitionValidation @group workbench_moderation

Namespace

Drupal\Tests\workbench_moderation\Unit

Code

public function userTransitionsProvider() {

  // The user has the right permission, so let it through.
  $ret[] = [
    'draft',
    'draft',
    'use draft__draft transition',
    TRUE,
    TRUE,
  ];

  // The user doesn't have the right permission, block it.
  $ret[] = [
    'draft',
    'draft',
    'use draft__draft transition',
    FALSE,
    FALSE,
  ];

  // The user has some other permission that doesn't matter.
  $ret[] = [
    'draft',
    'draft',
    'use draft__needs_review transition',
    TRUE,
    FALSE,
  ];

  // The user has permission, but the transition isn't allowed anyway.
  $ret[] = [
    'published',
    'needs_review',
    'use published__needs_review transition',
    TRUE,
    FALSE,
  ];
  return $ret;
}