public function WizardPluginBaseTest::testGetSelected in Drupal 9
Same name and namespace in other branches
- 8 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 21
Class
- WizardPluginBaseTest
- @coversDefaultClass \Drupal\views\Plugin\views\wizard\WizardPluginBase
Namespace
Drupal\Tests\views\UnitCode
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());
}