[Rt-commit] r9922 - rt/branches/3.6-RELEASE/lib/t/regression

ruz at bestpractical.com ruz at bestpractical.com
Wed Dec 12 15:31:20 EST 2007


Author: ruz
Date: Wed Dec 12 15:31:15 2007
New Revision: 9922

Modified:
   rt/branches/3.6-RELEASE/lib/t/regression/23cfsort.t

Log:
backport from 3.7

* add more tests to show that sorting by CF fails mark them as todo


Modified: rt/branches/3.6-RELEASE/lib/t/regression/23cfsort.t
==============================================================================
--- rt/branches/3.6-RELEASE/lib/t/regression/23cfsort.t	(original)
+++ rt/branches/3.6-RELEASE/lib/t/regression/23cfsort.t	Wed Dec 12 15:31:15 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use Test::More tests => 15;
+use Test::More tests => 21;
 use RT;
 RT::LoadConfig();
 RT::Init();
@@ -19,9 +19,11 @@
 
 # ---- Create a queue to test with.
 my $queue = "CFSortQueue-$$";
-my $queue_obj = RT::Queue->new($RT::SystemUser);
-($ret, $msg) = $queue_obj->Create(Name => $queue,
-                                  Description => 'queue for custom field sort testing');
+my $queue_obj = RT::Queue->new( $RT::SystemUser );
+($ret, $msg) = $queue_obj->Create(
+    Name => $queue,
+    Description => 'queue for custom field sort testing'
+);
 ok($ret, "$queue test queue creation. $msg");
 
 # ---- Create some custom fields.  We're not currently using all of
@@ -34,7 +36,7 @@
 ($ret, $msg) = $cfO->Create( Name => 'Order',
                              Queue => 0,
                              SortOrder => 1,
-                             Description => q[Something to compare results for, since we can't guarantee ticket ID],
+                             Description => q{Something to compare results for, since we can't guarantee ticket ID},
                              Type=> 'FreeformSingle');
 ok($ret, "Custom Field Order created");
 
@@ -86,7 +88,8 @@
   }
   my $results = join (" ", at results);
   my $order = join(" ", at order);
-  is( $results, $order , "Ordered correctly: $order");
+  @_ = ($results, $order , "Ordered correctly: $order");
+  goto \&is;
 }
 
 # The real tests start here
@@ -110,9 +113,23 @@
 # in Tickets_Overlay.
 $tx = new RT::Tickets( $RT::SystemUser );
 $tx->FromSQL(qq[queue="$queue"] );
-$tx->OrderBy( FIELD => "CF.{Charlie}", ORDER => 'DES' );
+$tx->OrderBy( FIELD => "CF.{Charlie}", ORDER => 'DESC' );
+diag $tx->BuildSelectQuery;
 is($tx->Count,2);
+TODO: {
+    local $TODO = 'order by CF fail';
 check_order( $tx, 1, 2);
+}
+
+$tx = new RT::Tickets( $RT::SystemUser );
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderBy( FIELD => "CF.{Charlie}", ORDER => 'ASC' );
+diag $tx->BuildSelectQuery;
+is($tx->Count,2);
+TODO: {
+    local $TODO = 'order by CF fail';
+check_order( $tx, 2, 1);
+}
 
 # Add a new ticket, to test sorting on multiple columns.
 my $t3 = RT::Ticket->new($RT::SystemUser);
@@ -126,18 +143,50 @@
 
 $tx = new RT::Tickets( $RT::SystemUser );
 $tx->FromSQL(qq[queue="$queue"] );
-$tx->OrderByCols({FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC'},
-                 {FIELD => "CF.${queue}.{Alpha}", ORDER => 'DES'}
-                );
+$tx->OrderByCols(
+    { FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC' },
+    { FIELD => "CF.${queue}.{Alpha}",   ORDER => 'DES' },
+);
 is($tx->Count,3);
+TODO: {
+    local $TODO = 'order by CF fail';
 check_order( $tx, 3, 2, 1);
+}
+
+$tx = new RT::Tickets( $RT::SystemUser );
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderByCols(
+    { FIELD => "CF.${queue}.{Charlie}", ORDER => 'DES' },
+    { FIELD => "CF.${queue}.{Alpha}",   ORDER => 'ASC' },
+);
+is($tx->Count,3);
+TODO: {
+    local $TODO = 'order by CF fail';
+check_order( $tx, 1, 2, 3);
+}
 
 # Reverse the order of the secondary column, which changes the order
 # of the first two tickets.
 $tx = new RT::Tickets( $RT::SystemUser );
 $tx->FromSQL(qq[queue="$queue"] );
-$tx->OrderByCols({FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC'},
-                 {FIELD => "CF.${queue}.{Alpha}", ORDER => 'ASC'}
-                );
+$tx->OrderByCols(
+    { FIELD => "CF.${queue}.{Charlie}", ORDER => 'ASC' },
+    { FIELD => "CF.${queue}.{Alpha}",   ORDER => 'ASC' },
+);
 is($tx->Count,3);
+TODO: {
+    local $TODO = 'order by CF fail';
 check_order( $tx, 2, 3, 1);
+}
+
+$tx = new RT::Tickets( $RT::SystemUser );
+$tx->FromSQL(qq[queue="$queue"] );
+$tx->OrderByCols(
+    { FIELD => "CF.${queue}.{Charlie}", ORDER => 'DES' },
+    { FIELD => "CF.${queue}.{Alpha}",   ORDER => 'DES' },
+);
+is($tx->Count,3);
+TODO: {
+    local $TODO = 'order by CF fail';
+check_order( $tx, 1, 3, 2);
+}


More information about the Rt-commit mailing list