You appear to be a bot. Output may be restricted
Description
Usage
Tests_Admin_wpCommentsListTable::test_sortable_columns_with_current_ordering();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/admin/wpCommentsListTable.php
Lines:
1 to 33 of 33
public function test_sortable_columns_with_current_ordering() { $override_sortable_columns = array( 'author' => array( 'comment_author', false ), 'response' => 'comment_post_ID', 'date' => array( 'comment_date', 'asc' ), // We will override this with current ordering. ); // Current ordering. $_GET['orderby'] = 'comment_date'; $_GET['order'] = 'desc'; // Stub the get_sortable_columns() method. $object = $this->getMockBuilder( 'WP_Comments_List_Table' ) ->setConstructorArgs( array( array( 'screen' => 'edit-comments' ) ) ) ->setMethods( array( 'get_sortable_columns' ) ) ->getMock(); // Change the null return value of the stubbed get_sortable_columns() method. $object->method( 'get_sortable_columns' ) ->willReturn( $override_sortable_columns ); $output = get_echo( array( $object, 'print_column_headers' ) ); $this->assertStringContainsString( '?orderby=comment_author&order=asc', $output, 'Mismatch of the default link ordering for comment author column. Should be asc.' ); $this->assertStringContainsString( 'column-author sortable desc', $output, 'Mismatch of CSS classes for the comment author column.' ); $this->assertStringContainsString( '?orderby=comment_post_ID&order=asc', $output, 'Mismatch of the default link ordering for comment response column. Should be asc.' ); $this->assertStringContainsString( 'column-response sortable desc', $output, 'Mismatch of CSS classes for the comment post ID column.' ); $this->assertStringContainsString( '?orderby=comment_date&order=asc', $output, 'Mismatch of the current link ordering for comment date column. Should be asc.' ); $this->assertStringContainsString( 'column-date sorted desc', $output, 'Mismatch of CSS classes for the comment date column.' ); }