1 views_exposed_form.test | public ViewsExposedFormTest::testRenameResetButton() |
Tests, whether and how the reset button can be renamed.
File
- core/
modules/ views/ tests/ views_exposed_form.test, line 16 - Definition of ViewsExposedFormTest.
Class
- ViewsExposedFormTest
- Tests exposed forms.
Code
public function testRenameResetButton() {
$account = $this->backdropCreateUser();
$this->backdropLogin($account);
// Create some random nodes.
for ($i = 0; $i < 5; $i++) {
$this->backdropCreateNode();
}
// Look at the page and check the label "reset".
$this->backdropGet('test_rename_reset_button');
// Rename the label of the reset button.
$view = views_get_view('test_rename_reset_button');
$view->set_display('default');
$exposed_form = $view->display_handler->get_option('exposed_form');
$exposed_form['options']['reset_button_label'] = $expected_label = $this->randomName();
$exposed_form['options']['reset_button'] = TRUE;
$view->display_handler->set_option('exposed_form', $exposed_form);
$view->save();
views_invalidate_cache();
// Look whether the reset button label changed.
$this->backdropGet('test_rename_reset_button');
$this->helperButtonHasLabel('edit-reset', $expected_label);
}