[Bast-commits] r5640 - in DBIx-Class/0.08/branches/bugfix_28451: . t/bugfixes

robkinyon at dev.catalyst.perl.org robkinyon at dev.catalyst.perl.org
Tue Feb 24 19:23:30 GMT 2009


Author: robkinyon
Date: 2009-02-24 19:23:30 +0000 (Tue, 24 Feb 2009)
New Revision: 5640

Modified:
   DBIx-Class/0.08/branches/bugfix_28451/Changes
   DBIx-Class/0.08/branches/bugfix_28451/t/bugfixes/rt28451.t
Log:
Made it into a real test

Modified: DBIx-Class/0.08/branches/bugfix_28451/Changes
===================================================================
--- DBIx-Class/0.08/branches/bugfix_28451/Changes	2009-02-24 18:06:39 UTC (rev 5639)
+++ DBIx-Class/0.08/branches/bugfix_28451/Changes	2009-02-24 19:23:30 UTC (rev 5640)
@@ -16,6 +16,7 @@
           to make it more matpath-friendly
         - deploy_statements called ddl_filename with the $version and $dir arguments
           in the wrong order. (groditi)
+        - Fix for RT#28451 (robkinyon)
 
 0.08099_06 2009-01-23 07:30:00 (UTC)
         - Allow a scalarref to be supplied to the 'from' resultset attribute

Modified: DBIx-Class/0.08/branches/bugfix_28451/t/bugfixes/rt28451.t
===================================================================
--- DBIx-Class/0.08/branches/bugfix_28451/t/bugfixes/rt28451.t	2009-02-24 18:06:39 UTC (rev 5639)
+++ DBIx-Class/0.08/branches/bugfix_28451/t/bugfixes/rt28451.t	2009-02-24 19:23:30 UTC (rev 5640)
@@ -10,7 +10,6 @@
 my $schema = DBICTest->init_schema(
     no_populate => 1,
 );
-$schema->storage()->debug( 1 );
 
 $schema->populate('28451::Account', [
     [ qw/account_id username person_id/ ],
@@ -32,18 +31,18 @@
     [ 3, 'Barney', 2 ],
 ]);
 
-plan tests => 1;
+plan tests => 6;
 
 my $rs = $schema->resultset('28451::Group')->search(
     undef,
     {
-        '+select' => [ { COUNT => 'members.person_id' } ],
+        '+select' => [ \'COUNT(members.person_id) AS member_count' ],
         '+as'     => [ qw/ member_count / ],
         join      => [ 'members' ],
         group_by  => [ qw/ me.group_id / ],
+        order_by  => [ \'member_count DESC' ],
     },
 );
-warn ${$rs->as_query}->[0], $/;
 
 $rs = $rs->search(
     undef,
@@ -51,11 +50,11 @@
         prefetch  => { account => 'person' },
     },
 );
-warn ${$rs->as_query}->[0], $/;
 
-foreach ( $rs->all() ) {
-     print "name:    " . $_->name() . "\n";
-     print "owner:   " . $_->account()->person()->first_name() . "\n";
-     print "members: " . $_->member_count() . "\n";
-     print "\n";
-}
+my @rows = $rs->all;
+is( $rows[0]->name, 'foo' );
+is( $rows[0]->account->person->first_name, 'Barney' );
+is( $rows[0]->member_count, '2' );
+is( $rows[1]->name, 'bar' );
+is( $rows[1]->account->person->first_name, 'Fred' );
+is( $rows[1]->member_count, '1' );




More information about the Bast-commits mailing list