You are here

public function FormElementHelperTest::getElementByNameProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php \Drupal\Tests\Core\Form\FormElementHelperTest::getElementByNameProvider()

Provides test data.

File

core/tests/Drupal/Tests/Core/Form/FormElementHelperTest.php, line 37
Contains \Drupal\Tests\Core\Form\FormElementHelperTest.

Class

FormElementHelperTest
Tests the form element helper.

Namespace

Drupal\Tests\Core\Form

Code

public function getElementByNameProvider() {
  $data = [];
  $data[] = [
    'id',
    [],
    [],
  ];
  $data[] = [
    'id',
    [
      'id' => [
        '#title' => 'ID',
        '#parents' => [
          'id',
        ],
      ],
    ],
    [
      '#title' => 'ID',
      '#parents' => [
        'id',
      ],
    ],
  ];
  $data[] = [
    'id',
    [
      'fieldset' => [
        'id' => [
          '#title' => 'ID',
          '#parents' => [
            'id',
          ],
        ],
        '#parents' => [
          'fieldset',
        ],
      ],
    ],
    [
      '#title' => 'ID',
      '#parents' => [
        'id',
      ],
    ],
  ];
  $data[] = [
    'fieldset',
    [
      'fieldset' => [
        'id' => [
          '#title' => 'ID',
          '#parents' => [
            'id',
          ],
        ],
        '#parents' => [
          'fieldset',
        ],
      ],
    ],
    [
      'id' => [
        '#title' => 'ID',
        '#parents' => [
          'id',
        ],
      ],
      '#parents' => [
        'fieldset',
      ],
    ],
  ];
  $data[] = [
    'fieldset][id',
    [
      'fieldset' => [
        '#tree' => TRUE,
        'id' => [
          '#title' => 'ID',
          '#parents' => [
            'fieldset',
            'id',
          ],
        ],
        '#parents' => [
          'fieldset',
        ],
      ],
    ],
    [
      '#title' => 'ID',
      '#parents' => [
        'fieldset',
        'id',
      ],
    ],
  ];
  return $data;
}