Tests the click sorting functionality.
public function testClickSorting() {
$this
->drupalGet('test_click_sort');
$this
->assertResponse(200);
// Only the id and name should be click sortable, but not the name.
$this
->assertLinkByHref(url('test_click_sort', array(
'query' => array(
'order' => 'id',
'sort' => 'asc',
),
)));
$this
->assertLinkByHref(url('test_click_sort', array(
'query' => array(
'order' => 'name',
'sort' => 'desc',
),
)));
$this
->assertNoLinkByHref(url('test_click_sort', array(
'query' => array(
'order' => 'created',
),
)));
// Clicking a click sort should change the order.
$this
->clickLink(t('ID'));
$this
->assertLinkByHref(url('test_click_sort', array(
'query' => array(
'order' => 'id',
'sort' => 'desc',
),
)));
// Check that the output has the expected order (asc).
$ids = $this
->clickSortLoadIdsFromOutput();
$this
->assertEqual($ids, range(1, 5));
$this
->clickLink(t('ID'));
// Check that the output has the expected order (desc).
$ids = $this
->clickSortLoadIdsFromOutput();
$this
->assertEqual($ids, range(5, 1, -1));
}