function WorkspaceAssociationTest::providerMoveTrackedEntitiesValidation

Data provider for testMoveTrackedEntitiesValidation().

Return value

array Test cases with workspace IDs, entity type, entity IDs, and expected exceptions.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationTest.php, line 398

Class

WorkspaceAssociationTest
Tests workspace associations.

Namespace

Drupal\Tests\workspaces\Kernel

Code

public static function providerMoveTrackedEntitiesValidation() : array {
  return [
    'same source and target workspace' => [
      'source_workspace_id' => 'qa',
      'target_workspace_id' => 'qa',
      'entity_type_id' => 'entity_test_mulrevpub',
      'entity_ids' => NULL,
      'exception_class' => \InvalidArgumentException::class,
      'exception_message' => 'Source and target workspace IDs cannot be the same.',
    ],
    'entity IDs without entity type' => [
      'source_workspace_id' => 'stage',
      'target_workspace_id' => 'qa',
      'entity_type_id' => NULL,
      'entity_ids' => [
        1,
        2,
        3,
      ],
      'exception_class' => \InvalidArgumentException::class,
      'exception_message' => 'Entity type ID must be provided when entity IDs are specified.',
    ],
    'source workspace is not top-level' => [
      'source_workspace_id' => 'dev',
      'target_workspace_id' => 'qa',
      'entity_type_id' => 'entity_test_mulrevpub',
      'entity_ids' => NULL,
      'exception_class' => \DomainException::class,
      'exception_message' => 'Both the source and target must be valid top-level workspaces.',
    ],
    'target workspace is not top-level' => [
      'source_workspace_id' => 'qa',
      'target_workspace_id' => 'dev',
      'entity_type_id' => 'entity_test_mulrevpub',
      'entity_ids' => NULL,
      'exception_class' => \DomainException::class,
      'exception_message' => 'Both the source and target must be valid top-level workspaces.',
    ],
    'source workspace has children' => [
      'source_workspace_id' => 'stage',
      'target_workspace_id' => 'qa',
      'entity_type_id' => 'entity_test_mulrevpub',
      'entity_ids' => NULL,
      'exception_class' => \DomainException::class,
      'exception_message' => 'Both the source and target must be valid top-level workspaces.',
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.