You are here

public function ExtraFieldDisplayManagerTest::fieldInfoProvider in Extra Field 8.2

Data provider for testFieldInfo().

File

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

Class

ExtraFieldDisplayManagerTest
@coversDefaultClass \Drupal\extra_field\Plugin\ExtraFieldDisplayManager

Namespace

Drupal\Tests\extra_field\Unit

Code

public function fieldInfoProvider() {
  $info[] = [
    // Definitions.
    [
      'test' => [
        'id' => 'test',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display node article',
        'description' => 'test description display node article',
        'weight' => 0,
        'visible' => FALSE,
      ],
    ],
    // Bundles.
    [],
    // Results.
    [
      'node' => [
        'article' => [
          'display' => [
            'extra_field_test' => [
              'label' => 'test display node article',
              'description' => 'test description display node article',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
      ],
    ],
  ];
  $info[] = [
    // Definitions.
    [
      'test' => [
        'id' => 'test',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display node article',
        'description' => 'test description display node article',
        'weight' => 88,
        'visible' => TRUE,
      ],
    ],
    // Bundles.
    [],
    // Results.
    [
      'node' => [
        'article' => [
          'display' => [
            'extra_field_test' => [
              'label' => 'test display node article',
              'description' => 'test description display node article',
              'weight' => 88,
              'visible' => TRUE,
            ],
          ],
        ],
      ],
    ],
  ];
  $info[] = [
    // Definitions.
    [
      'test1' => [
        'id' => 'test1',
        'bundles' => [
          'node.*',
          'voucher.*',
        ],
        'label' => 'test display 1',
        'description' => 'test description display 1',
        'weight' => 0,
        'visible' => FALSE,
      ],
      'test2' => [
        'id' => 'test2',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display 2',
        'description' => 'test description display 2',
        'weight' => 2,
        'visible' => TRUE,
      ],
    ],
    // Bundles.
    [
      [
        'node',
        [
          'article',
          'story',
          'blog',
        ],
      ],
      [
        'voucher',
        [
          'simple',
          'extended',
        ],
      ],
    ],
    // Results.
    [
      'node' => [
        'article' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'description' => 'test description display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
            'extra_field_test2' => [
              'label' => 'test display 2',
              'description' => 'test description display 2',
              'weight' => 2,
              'visible' => TRUE,
            ],
          ],
        ],
        'story' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'description' => 'test description display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
        'blog' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'description' => 'test description display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
      ],
      'voucher' => [
        'simple' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'description' => 'test description display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
        'extended' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'description' => 'test description display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
      ],
    ],
  ];
  return $info;
}