diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php index 906ffc7..7da12c6 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php @@ -42,25 +42,24 @@ function testContentAdminSort() { $this->drupalCreateNode(array('title' => $prefix . $this->randomName(6))); } - // Test that the default sort by node.changed DESC actually fires properly. - // @todo: These nodes have all the same changed date, adding the distinct() - // Fixing by adding a secondary sort on the node id to produce the - // expected behavior. Consider manually setting an older changed date to - // test this with useful data. - $nodes_query = db_select('node_property_data', 'npd') - ->distinct(TRUE) - ->fields('npd', array('nid')) - ->orderBy('changed', 'DESC') - ->orderBy('nid', 'ASC') + // Test that the default sort by npd.changed DESC actually fires properly. + $query = db_select('node', 'n'); + $query->innerJoin('node_property_data', 'npd', 'npd.nid = n.nid'); + $nodes_query = $query->fields('npd', array('nid')) + ->orderBy('npd.changed', 'DESC') ->execute() ->fetchCol(); + debug($nodes_query); + $nodes_form = array(); $this->drupalGet('admin/content'); foreach ($this->xpath('//table/tbody/tr/td/div/input/@value') as $input) { $nodes_form[] = $input; } + debug($nodes_form); + $this->assertEqual($nodes_query, $nodes_form, 'Nodes are sorted in the form according to the default query.'); // Compare the rendered HTML node list to a query for the nodes ordered by