You are here

public function EntityToTableRendererTest::tableRenderingDataProvider in Reference Table Formatter 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/EntityToTableRendererTest.php \Drupal\Tests\reference_table_formatter\Kernel\EntityToTableRendererTest::tableRenderingDataProvider()

Data provider for testing the table builder.

File

tests/src/Kernel/EntityToTableRendererTest.php, line 155

Class

EntityToTableRendererTest
Tests reference table formatter entity to table renderer.

Namespace

Drupal\Tests\reference_table_formatter\Kernel

Code

public function tableRenderingDataProvider() {
  return [
    'Standard table' => [
      [
        'show_entity_label' => TRUE,
        'view_mode' => 'teaser',
        'empty_cell_value' => '',
        'hide_header' => FALSE,
      ],
      [
        'title' => 'Title',
        'field_price' => 'Price',
        'field_size' => 'Size',
        'field_color' => 'Color',
      ],
      [
        [
          'Red Medium T',
          '$1.00',
          'M',
          'Red',
        ],
        [
          'Green Large T',
          '$2.00',
          'L',
          'Green',
        ],
      ],
    ],
    'No entity label' => [
      [
        'show_entity_label' => FALSE,
        'view_mode' => 'teaser',
        'empty_cell_value' => '',
        'hide_header' => FALSE,
      ],
      [
        'field_price' => 'Price',
        'field_size' => 'Size',
        'field_color' => 'Color',
      ],
      [
        [
          '$1.00',
          'M',
          'Red',
        ],
        [
          '$2.00',
          'L',
          'Green',
        ],
      ],
    ],
    'Incomplete rows' => [
      [
        'show_entity_label' => FALSE,
        'view_mode' => 'teaser',
        'empty_cell_value' => '',
        'hide_header' => FALSE,
      ],
      [
        'field_price' => 'Price',
        'field_size' => 'Size',
        'field_color' => 'Color',
      ],
      [
        [
          '$1.00',
          '',
          'Red',
        ],
        [
          '$2.00',
          'L',
          'Green',
        ],
      ],
      TRUE,
    ],
    'Empty cell' => [
      [
        'show_entity_label' => FALSE,
        'view_mode' => 'teaser',
        'empty_cell_value' => 'N/A',
        'hide_header' => FALSE,
      ],
      [
        'field_price' => 'Price',
        'field_size' => 'Size',
        'field_color' => 'Color',
      ],
      [
        [
          '$1.00',
          'N/A',
          'Red',
        ],
        [
          '$2.00',
          'L',
          'Green',
        ],
      ],
      TRUE,
    ],
  ];
}