You are here

public function WizardPluginBaseTest::testGetSelected in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/WizardPluginBaseTest.php \Drupal\Tests\views\Unit\WizardPluginBaseTest::testGetSelected()

@covers ::getSelected

@dataProvider providerTestGetSelected

File

core/modules/views/tests/src/Unit/WizardPluginBaseTest.php, line 26
Contains \Drupal\Tests\views\Unit\WizardPluginBaseTest.

Class

WizardPluginBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\wizard\WizardPluginBase

Namespace

Drupal\Tests\views\Unit

Code

public function testGetSelected($expected, $element = [], $parents = [], $user_input = [], $not_rebuilding_expected = NULL) {
  $not_rebuilding_expected = $not_rebuilding_expected ?: $expected;
  $form_state = new FormState();
  $form_state
    ->setUserInput($user_input);
  $actual = WizardPluginBase::getSelected($form_state, $parents, 'the_default_value', $element);
  $this
    ->assertSame($not_rebuilding_expected, $actual);
  $this
    ->assertSame($user_input, $form_state
    ->getUserInput());
  $form_state
    ->setRebuild();
  $actual = WizardPluginBase::getSelected($form_state, $parents, 'the_default_value', $element);
  $this
    ->assertSame($expected, $actual);
  $this
    ->assertSame($user_input, $form_state
    ->getUserInput());
}