public function ExposedFormTest::testExposedFormRender

Tests the exposed form markup.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php, line 98
Contains \Drupal\views\Tests\Plugin\ExposedFormTest.

Class

ExposedFormTest
Tests exposed forms.

Namespace

Drupal\views\Tests\Plugin

Code

public function testExposedFormRender() {
  $view = views_get_view('test_reset_button');
  $this
    ->executeView($view);
  $exposed_form = $view->display_handler
    ->getPlugin('exposed_form');
  $output = $exposed_form
    ->renderExposedForm();
  $this
    ->drupalSetContent(drupal_render($output));
  $expected_id = drupal_clean_css_identifier('views-exposed-form-' . $view->storage
    ->id() . '-' . $view->current_display);
  $this
    ->assertFieldByXpath('//form/@id', $expected_id, 'Expected form ID found.');
  $expected_action = url($view->display_handler
    ->getUrl());
  $this
    ->assertFieldByXPath('//form/@action', $expected_action, 'The expected value for the action attribute was found.');
}