function ExposedFormTest::testTextInputRequired
Same name in other branches
- 9 core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testTextInputRequired()
- 8.9.x core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testTextInputRequired()
- 10 core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormTest::testTextInputRequired()
Tests the "on demand text" for the input required exposed form type.
1 call to ExposedFormTest::testTextInputRequired()
- ExposedFormTest::testExposedForm in core/
modules/ views/ tests/ src/ Functional/ Plugin/ ExposedFormTest.php - Tests the input required exposed form type.
File
-
core/
modules/ views/ tests/ src/ Functional/ Plugin/ ExposedFormTest.php, line 368
Class
- ExposedFormTest
- Tests exposed forms functionality.
Namespace
Drupal\Tests\views\Functional\PluginCode
protected function testTextInputRequired() : void {
$view = Views::getView('test_exposed_form_buttons');
$display =& $view->storage
->getDisplay('default');
$display['display_options']['exposed_form']['type'] = 'input_required';
// Set up the "on demand text".
// @see https://www.drupal.org/node/535868
$on_demand_text = 'Select any filter and click Apply to see results.';
$display['display_options']['exposed_form']['options']['text_input_required'] = $on_demand_text;
$display['display_options']['exposed_form']['options']['text_input_required_format'] = filter_default_format();
$view->save();
// Ensure that the "on demand text" is displayed when no exposed filters are
// applied.
$this->drupalGet('test_exposed_form_buttons');
$this->assertSession()
->pageTextContains('Select any filter and click Apply to see results.');
// Ensure that the "on demand text" is not displayed when an exposed filter
// is applied.
$this->drupalGet('test_exposed_form_buttons', [
'query' => [
'type' => 'article',
],
]);
$this->assertSession()
->pageTextNotContains($on_demand_text);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.