Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
simpletest.module
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
20 Jun 2009 at 02:13 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
oestrich commentedGonna have a go at this.
Comment #2
oestrich commentedHere goes nothing.
Comment #3
webchickHere's a code-style review. Haven't tested the patch yet.
1. You're introducing trailing whitespace on that first + line.
2. The uasort should be indented as far as the );. We use 2 spaces rather than tabs for indentation. See http://drupal.org/coding-standards
1. This function should have a line of PHPDoc to explain what it is for.
2. There should be a space after the ) and before the { in the function definition and if.
3. There should be a space between if and (
Curious. Why return 1; if those aren't set? And under what circumstances will the #title property not get set? http://api.drupal.org/api/function/system_sort_modules_by_info_name/7 looks similar to this and doesn't have that if (!isset(..)) stuff.
We could probably do with a couple of inline comments to explain what's happening here.
Comment #4
oestrich commentedThe if(!isset()) part is for the other parts of $element that are not arrays or include #title. There are lots of errors if this isn't included.
I returned 1 because 0 didn't work. Not the best reason, but hey it works.
The tabs were there because my editor hadn't been switched over to use spaces instead of tabs.
Comment #5
paulhenrich commentedJust applied the patch to my D7 install (-dev from drupal.org/project tonight, not cvs). It seems to work just fine. I've attached a screen capture.
Comment #6
cwgordon7 commentedCode comments should start with a space and a capital letter and end with a period. (
//Sorting $element by it's childrens #title attribute instead of by class nameshould be// Sorting $element by it's childrens #title attribute instead of by class name.. Comments also should wrap at 80 characters. Same thing applies for the other code comments)."_simpletest_sort_by_title" - we typically use single quotes for consistency, so '_simpletest_sort_by_title' would probably be better. We use double quotes for cases such as "stuff with apos'trophes" and "stuff with $variable in it".
if (!isset($a['#title']) || !isset($b['#title'])){- there should be a space between the control structure and the opening bracket, such as:if (!isset($a['#title']) || !isset($b['#title'])) {.Other than code style issues, though, it looks good, and this change will definitely make SimpleTest more usable. :)
Comment #7
oestrich commentedAlright, third times the charm.
Comment #8
cwgordon7 commentedAwesome, this is a great change, it's really irksome trying to find the test you're trying to run in an alphabetized list of tests. This passes tests, and works, and complies with coding standards. Thank you very much!
Comment #9
webchickw00t! This has bothered me for many months.
Thanks so much, oestrich! Committed to HEAD. :)