From 800cdcc840ea138ca9c207cb43dcb6300995e4b3 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 7 Oct 2010 17:31:39 +0000 Subject: #700380 by mitchmac, Dave Reid, mfb, Ryan Palmer, justinrandell: Fix sorting in tableselect if #weight is not set. --- modules/node/node.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'modules/node/node.test') diff --git a/modules/node/node.test b/modules/node/node.test index 59b12f008..66d6bf757 100644 --- a/modules/node/node.test +++ b/modules/node/node.test @@ -1278,6 +1278,30 @@ class NodeAdminTestCase extends DrupalWebTestCase { $this->base_user_3 = $this->drupalCreateUser(array('access content overview', 'bypass node access')); } + /** + * Tests that the table sorting works on the content admin pages. + */ + function testContentAdminSort() { + $this->drupalLogin($this->admin_user); + foreach (array('dd', 'aa', 'DD', 'bb', 'cc', 'CC', 'AA', 'BB') as $prefix) { + $this->drupalCreateNode(array('title' => $prefix . $this->randomName(6))); + } + + // Compare the rendered HTML node list to a query for the nodes ordered by + // title to account for possible database-dependent sort order. + $nodes_query = db_select('node', 'n') + ->fields('n', array('nid')) + ->orderBy('title') + ->execute() + ->fetchCol(); + + $this->drupalGet('admin/content', array('query' => array('sort' => 'asc', 'order' => 'Title'))); + foreach ($this->xpath('//table/tbody/tr/td/div/input/@value') as $input) { + $nodes_form[] = $input; + } + $this->assertEqual($nodes_query, $nodes_form, 'Nodes are sorted in the form the same as they are in the query.'); + } + /** * Tests content overview with different user permissions. * -- cgit v1.2.3