You are here

public function StateItemTest::providerTestField in State Machine 8

Data provider for ::testField.

Return value

array A list of testField function arguments.

File

tests/src/Kernel/StateItemTest.php, line 107

Class

StateItemTest
@coversDefaultClass \Drupal\state_machine\Plugin\Field\FieldType\StateItem @group state_machine

Namespace

Drupal\Tests\state_machine\Kernel

Code

public function providerTestField() {
  $data = [];
  $data['new->validation'] = [
    'new',
    [
      'create',
      'cancel',
    ],
    'fulfillment',
    'create',
    'validation',
  ];
  $data['new->canceled'] = [
    'new',
    [
      'create',
      'cancel',
    ],
    'completed',
    'cancel',
    'canceled',
  ];

  // The workflow defines validation->fulfillment and validation->canceled
  // transitions, but the second one is forbidden by the GenericGuard.
  $data['validation->fulfillment'] = [
    'validation',
    [
      'validate',
    ],
    'completed',
    'validate',
    'fulfillment',
  ];

  // The workflow defines fulfillment->completed and fulfillment->canceled
  // transitions, but the second one is forbidden by the FulfillmentGuard.
  $data['fulfillment->completed'] = [
    'fulfillment',
    [
      'fulfill',
    ],
    'new',
    'fulfill',
    'completed',
  ];
  return $data;
}