You are here

public function ExtraFieldDisplayManagerTest::entityViewProvider in Extra Field 8.2

Data provider for testFieldInfo().

File

tests/src/Unit/ExtraFieldDisplayManagerTest.php, line 347

Class

ExtraFieldDisplayManagerTest
@coversDefaultClass \Drupal\extra_field\Plugin\ExtraFieldDisplayManager

Namespace

Drupal\Tests\extra_field\Unit

Code

public function entityViewProvider() {
  $info[] = [
    // Definitions.
    [],
    // Entity type.
    '',
    // Bundle.
    '',
    // Has component.
    FALSE,
    // Result.
    [],
  ];
  $info[] = [
    // Definitions.
    [
      'plugin_id' => [
        'bundles' => [],
      ],
    ],
    // Entity type.
    'entity_type',
    // Bundle.
    'bundle',
    // Has component.
    FALSE,
    // Result.
    [],
  ];
  $info[] = [
    // Definitions.
    [
      'plugin_id' => [
        'bundles' => [],
      ],
    ],
    // Entity type.
    'entity_type',
    // Bundle.
    'bundle',
    // Has component.
    FALSE,
    // Result.
    [],
  ];
  $info[] = [
    // Definitions.
    [
      'test' => [
        'id' => 'test',
        'bundles' => [
          'node.*',
        ],
        'label' => 'test display node article',
        'weight' => 0,
        'visible' => TRUE,
      ],
    ],
    // Entity type.
    'node',
    // Bundle.
    'article',
    // Has component.
    TRUE,
    // Result.
    [
      'extra_field_test' => [
        'mock' => 'display markup',
      ],
    ],
  ];
  $info[] = [
    // Definitions.
    [
      'first_test' => [
        'id' => 'test',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display node article',
        'weight' => 0,
        'visible' => TRUE,
      ],
      'second_test' => [
        'id' => 'test',
        'bundles' => [
          'node.page',
        ],
        'label' => 'test display node page',
        'weight' => 0,
        'visible' => TRUE,
      ],
    ],
    // Entity type.
    'node',
    // Bundle.
    'page',
    // Has component.
    TRUE,
    // Result.
    [
      'extra_field_second_test' => [
        'mock' => 'display markup',
      ],
    ],
  ];
  return $info;
}