public function ExposedFormTest::testInputRequired in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Plugin/ExposedFormTest.php \Drupal\views\Tests\Plugin\ExposedFormTest::testInputRequired()
Test the input required exposed form type.
File
- core/
modules/ views/ src/ Tests/ Plugin/ ExposedFormTest.php, line 175 - Contains \Drupal\views\Tests\Plugin\ExposedFormTest.
Class
- ExposedFormTest
- Tests exposed forms functionality.
Namespace
Drupal\views\Tests\PluginCode
public function testInputRequired() {
$view = entity_load('view', 'test_exposed_form_buttons');
$display =& $view
->getDisplay('default');
$display['display_options']['exposed_form']['type'] = 'input_required';
$view
->save();
$this
->drupalGet('test_exposed_form_buttons');
$this
->assertResponse(200);
$this
->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', t('Apply'));
// Ensure that no results are displayed.
$rows = $this
->xpath("//div[contains(@class, 'views-row')]");
$this
->assertEqual(count($rows), 0, 'No rows are displayed by default when no input is provided.');
$this
->drupalGet('test_exposed_form_buttons', array(
'query' => array(
'type' => 'article',
),
));
// Ensure that results are displayed.
$rows = $this
->xpath("//div[contains(@class, 'views-row')]");
$this
->assertEqual(count($rows), 5, 'All rows are displayed by default when input is provided.');
}