You are here

public function DazzlerTest::providerTraverse in Formdazzle! 2.x

Data provider for testFormAlter().

See also

testFormAlter()

File

tests/src/Unit/DazzlerTest.php, line 448

Class

DazzlerTest
@coversDefaultClass \Drupal\formdazzle\Dazzler @group formdazzle

Namespace

Drupal\Tests\formdazzle\Unit

Code

public function providerTraverse() {

  // Initial form.
  $form_id = 'simple_form';
  $form_suggestion = 'a_form_suggestion';
  $form = $this
    ->getFixture($form_id) + [
    'parent' => $this
      ->getFixture('with_theme_and_wrappers') + [
      '#parents' => [
        'parent',
      ],
      'child' => $this
        ->getFixture('with_theme') + [
        '#parents' => [
          'parent',
          'child',
        ],
      ],
    ],
  ];

  // Expected form.
  $expected = $form;
  $expected['#theme_wrappers'] = [
    'form__a_form_suggestion',
  ];
  $expected['parent']['#theme'] = 'with_theme__a_form_suggestion__parent';
  $expected['parent']['#theme_wrappers'] = [
    'with_theme_wrapper__a_form_suggestion__parent',
  ];
  $expected['parent']['child']['#theme'] = 'with_theme__a_form_suggestion__parent_child';
  return [
    'traverses a form' => [
      $form,
      $form_id,
      $form_suggestion,
      $expected,
    ],
  ];
}