protected function BEF_TestBase::addSort in Better Exposed Filters 7.3
Adds a sort to a view display. See addFilter for parameter options.
Note: This routine expects the caller to save the view, as needed.
2 calls to BEF_TestBase::addSort()
- BEF_TestRewrite::test_befFilterRewrite in tests/
better_exposed_filters.test - Verify rewriting works for filter options
- BEF_TestSort::test_befExposedSort in tests/
better_exposed_filters.test - Verify exposed sorts, including the combined sort/operator option and option rewriting, work with BEF.
File
- tests/
better_exposed_filters_TestBase.php, line 209 - Base class for testing the Better Exposed Filters module. @author mikeker
Class
- BEF_TestBase
- Helper functions for Better Exposed Filters tests.
Code
protected function addSort($field, $settings = array(), $additional = array(), $exposed = TRUE, $display = 'default') {
$edit = array(
"name[{$field}]" => TRUE,
);
$url = 'admin/structure/views/nojs/add-item/' . $this->view['machine_name'] . "/{$display}/sort";
$this
->drupalPost($url, $edit, 'Add and configure sort criteria');
if (!empty($additional)) {
// Handle filter-specific options screen.
$this
->drupalPost(NULL, $additional, 'Apply');
}
if ($exposed) {
$this
->drupalPost(NULL, array(), 'Expose sort');
}
$this
->drupalPost(NULL, $settings, 'Apply');
}