You are here

public function Select2Test::providerTestPlaceholderPropertyRendering in Select 2 8

Data provider for testPlaceholderPropertyRendering().

File

tests/src/Unit/Element/Select2Test.php, line 220

Class

Select2Test
@coversDefaultClass \Drupal\select2\Element\Select2 @group select2

Namespace

Drupal\Tests\select2\Unit\Element

Code

public function providerTestPlaceholderPropertyRendering() {
  $data = [];
  $data[] = [
    TRUE,
    '',
    '',
    '',
    [
      'id' => '',
      'text' => '- Select -',
    ],
  ];
  $data[] = [
    FALSE,
    '',
    '',
    '',
    [
      'id' => '',
      'text' => '- None -',
    ],
  ];
  $data[] = [
    FALSE,
    NULL,
    NULL,
    NULL,
    [
      'id' => '',
      'text' => '- None -',
    ],
  ];
  $data[] = [
    FALSE,
    new TranslatableMarkup('empty_option'),
    NULL,
    NULL,
    [
      'id' => '',
      'text' => 'empty_option',
    ],
  ];
  $data[] = [
    FALSE,
    new TranslatableMarkup('empty_option'),
    NULL,
    new TranslatableMarkup('placeholder'),
    [
      'id' => '',
      'text' => 'placeholder',
    ],
  ];
  $data[] = [
    FALSE,
    NULL,
    NULL,
    new TranslatableMarkup('placeholder'),
    [
      'id' => '',
      'text' => 'placeholder',
    ],
  ];
  $data[] = [
    FALSE,
    NULL,
    'foo',
    new TranslatableMarkup('placeholder'),
    [
      'id' => 'foo',
      'text' => 'placeholder',
    ],
  ];
  $data[] = [
    TRUE,
    NULL,
    'foo',
    new TranslatableMarkup('placeholder'),
    [
      'id' => 'foo',
      'text' => 'placeholder',
    ],
  ];
  return $data;
}