You are here

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

Data provider for testFormAlter().

See also

testFormAlter()

File

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

Class

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

Namespace

Drupal\Tests\formdazzle\Unit

Code

public function providerFormAlter() {
  $data = [];
  $class = 'Drupal\\formdazzle\\Dazzler';
  $actual = $this
    ->getFixture('simple_form');
  $expected = $actual + [
    '#pre_render' => [
      [
        $class,
        'preRenderForm',
      ],
    ],
    '#formdazzle' => [
      'form_id' => 'a_form_id',
    ],
  ];
  $data['adds a #pre_render array to the form'] = [
    $actual,
    'a_form_id',
    $expected,
  ];
  $actual = $this
    ->getFixture('simple_form') + [
    '#pre_render' => [
      'some_pre_render',
    ],
  ];
  $expected = $actual + [
    '#formdazzle' => [
      'form_id' => 'a_form_id',
    ],
  ];
  $expected['#pre_render'] = [
    'some_pre_render',
    [
      $class,
      'preRenderForm',
    ],
  ];
  $data['appends to an existing #pre_render array in the form'] = [
    $actual,
    'a_form_id',
    $expected,
  ];
  return $data;
}