Data provider for unit test.
array The source data and expected data.
public static function getData() {
$data = [
'With one bundle allowed' => [
'source' => [
'allowed_bundles' => [
'paragraph_bundle_one' => 'paragraph_bundle_one',
'paragraph_bundle_two' => -1,
],
'bundle_weights' => [
'paragraph_bundle_one' => 1,
'paragraph_bundle_two' => 2,
],
],
'expected' => [
'handler_settings' => [
'negate' => 0,
'target_bundles' => [
'paragraph_bundle_one' => 'paragraph_bundle_one',
],
'target_bundles_drag_drop' => [
'paragraph_bundle_one' => [
'enabled' => TRUE,
'weight' => 1,
],
'paragraph_bundle_two' => [
'enabled' => FALSE,
'weight' => 2,
],
'field_collection_bundle_one' => [
'enabled' => FALSE,
'weight' => 3,
],
'field_collection_bundle_two' => [
'enabled' => FALSE,
'weight' => 4,
],
'prexisting_bundle_one' => [
'enabled' => FALSE,
'weight' => 5,
],
'prexisting_bundle_two' => [
'enabled' => FALSE,
'weight' => 6,
],
],
],
],
],
'With all bundles allowed' => [
'source' => [
'allowed_bundles' => [
'paragraph_bundle_one' => -1,
'paragraph_bundle_two' => -1,
],
'bundle_weights' => [
'paragraph_bundle_one' => 1,
'paragraph_bundle_two' => 2,
],
],
'expected' => [
'handler_settings' => [
'negate' => 0,
'target_bundles' => NULL,
'target_bundles_drag_drop' => [
'paragraph_bundle_one' => [
'enabled' => FALSE,
'weight' => 1,
],
'paragraph_bundle_two' => [
'enabled' => FALSE,
'weight' => 2,
],
'field_collection_bundle_one' => [
'enabled' => FALSE,
'weight' => 3,
],
'field_collection_bundle_two' => [
'enabled' => FALSE,
'weight' => 4,
],
'prexisting_bundle_one' => [
'enabled' => FALSE,
'weight' => 5,
],
'prexisting_bundle_two' => [
'enabled' => FALSE,
'weight' => 6,
],
],
],
],
],
];
return $data;
}