public function ExposedFormTest::testExposedSortAndItemsPerPage in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Tests/Plugin/ExposedFormTest.php \Drupal\views\Tests\Plugin\ExposedFormTest::testExposedSortAndItemsPerPage()
Tests exposed forms with exposed sort and items per page.
File
- core/
modules/ views/ src/ Tests/ Plugin/ ExposedFormTest.php, line 224 - Contains \Drupal\views\Tests\Plugin\ExposedFormTest.
Class
- ExposedFormTest
- Tests exposed forms functionality.
Namespace
Drupal\views\Tests\PluginCode
public function testExposedSortAndItemsPerPage() {
for ($i = 0; $i < 50; $i++) {
$entity = EntityTest::create([]);
$entity
->save();
}
$contexts = [
'languages:language_interface',
'entity_test_view_grants',
'theme',
'url.query_args',
'languages:language_content',
];
$this
->drupalGet('test_exposed_form_sort_items_per_page');
$this
->assertCacheContexts($contexts);
$this
->assertIds(range(1, 10, 1));
$this
->drupalGet('test_exposed_form_sort_items_per_page', [
'query' => [
'sort_order' => 'DESC',
],
]);
$this
->assertCacheContexts($contexts);
$this
->assertIds(range(50, 41, 1));
$this
->drupalGet('test_exposed_form_sort_items_per_page', [
'query' => [
'sort_order' => 'DESC',
'items_per_page' => 25,
],
]);
$this
->assertCacheContexts($contexts);
$this
->assertIds(range(50, 26, 1));
$this
->drupalGet('test_exposed_form_sort_items_per_page', [
'query' => [
'sort_order' => 'DESC',
'items_per_page' => 25,
'offset' => 10,
],
]);
$this
->assertCacheContexts($contexts);
$this
->assertIds(range(40, 16, 1));
}