public function ExposedFormTest::testRenameResetButton

Tests, whether and how the reset button can be renamed.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php, line 69
Definition of Drupal\views\Tests\Plugin\ExposedFormTest.

Class

ExposedFormTest
Tests exposed forms.

Namespace

Drupal\views\Tests\Plugin

Code

public function testRenameResetButton() {

  // Look at the page and check the label "reset".
  $this
    ->drupalGet('test_reset_button');

  // Rename the label of the reset button.
  $view = views_get_view('test_reset_button');
  $view
    ->setDisplay();
  $exposed_form = $view->display_handler
    ->getOption('exposed_form');
  $exposed_form['options']['reset_button_label'] = $expected_label = $this
    ->randomName();
  $exposed_form['options']['reset_button'] = TRUE;
  $view->display_handler
    ->setOption('exposed_form', $exposed_form);
  $view
    ->save();
  views_invalidate_cache();

  // Look whether ther reset button label changed.
  $this
    ->drupalGet('test_reset_button');
  $this
    ->assertResponse(200);
  $this
    ->helperButtonHasLabel('edit-reset', $expected_label);
}