[Bast-commits] r7958 - in DBIx-Class/0.08/trunk/t: . count lib lib/DBICTest/Schema

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Nov 26 13:23:28 GMT 2009


Author: ribasushi
Date: 2009-11-26 13:23:28 +0000 (Thu, 26 Nov 2009)
New Revision: 7958

Modified:
   DBIx-Class/0.08/trunk/t/93single_accessor_object.t
   DBIx-Class/0.08/trunk/t/count/prefetch.t
   DBIx-Class/0.08/trunk/t/lib/DBICTest.pm
   DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm
Log:
Add a no-accessor column to generally test handling

Modified: DBIx-Class/0.08/trunk/t/93single_accessor_object.t
===================================================================
--- DBIx-Class/0.08/trunk/t/93single_accessor_object.t	2009-11-26 11:52:05 UTC (rev 7957)
+++ DBIx-Class/0.08/trunk/t/93single_accessor_object.t	2009-11-26 13:23:28 UTC (rev 7958)
@@ -48,7 +48,7 @@
 	my $artist = $schema->resultset('Artist')->create({ artistid => 666, name => 'bad religion' });
 	my $cd = $schema->resultset('CD')->create({ cdid => 187, artist => 1, title => 'how could hell be any worse?', year => 1982, genreid => undef });
 
-	ok(!defined($cd->genreid), 'genreid is NULL');
+	ok(!defined($cd->get_column('genreid')), 'genreid is NULL');  #no accessor was defined for this column
 	ok(!defined($cd->genre), 'genre accessor returns undef');
 }
 

Modified: DBIx-Class/0.08/trunk/t/count/prefetch.t
===================================================================
--- DBIx-Class/0.08/trunk/t/count/prefetch.t	2009-11-26 11:52:05 UTC (rev 7957)
+++ DBIx-Class/0.08/trunk/t/count/prefetch.t	2009-11-26 13:23:28 UTC (rev 7958)
@@ -39,16 +39,9 @@
 
 # collapsing prefetch with distinct
 {
-  my $first_cd = $schema->resultset('Artist')->first->cds->first;
-  $first_cd->update ({
-    genreid => $first_cd->create_related (
-      genre => ({ name => 'vague genre' })
-    )->id
-  });
-
   my $rs = $schema->resultset("Artist")->search(undef, {distinct => 1})
             ->search_related('cds')->search_related('genre',
-                { 'genre.name' => { '!=', 'foo' } },
+                { 'genre.name' => 'emo' },
                 { prefetch => q(cds) },
             );
   is ($rs->all, 1, 'Correct number of objects');
@@ -64,11 +57,11 @@
             JOIN cd cds ON cds.artist = me.artistid
             JOIN genre genre ON genre.genreid = cds.genreid
             LEFT JOIN cd cds_2 ON cds_2.genreid = genre.genreid
-          WHERE ( genre.name != ? )
+          WHERE ( genre.name = ? )
           GROUP BY genre.genreid
         ) count_subq
     )',
-    [ [ 'genre.name' => 'foo' ] ],
+    [ [ 'genre.name' => 'emo' ] ],
   );
 }
 

Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm	2009-11-26 11:52:05 UTC (rev 7957)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/CD.pm	2009-11-26 13:23:28 UTC (rev 7958)
@@ -26,6 +26,7 @@
   'genreid' => { 
     data_type => 'integer',
     is_nullable => 1,
+    accessor => 'undef',
   },
   'single_track' => {
     data_type => 'integer',

Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest.pm	2009-11-26 11:52:05 UTC (rev 7957)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest.pm	2009-11-26 13:23:28 UTC (rev 7958)
@@ -155,6 +155,11 @@
     my $self = shift;
     my $schema = shift;
 
+    $schema->populate('Genre', [
+      [qw/genreid name/],
+      [qw/1       emo  /],
+    ]);
+
     $schema->populate('Artist', [
         [ qw/artistid name/ ],
         [ 1, 'Caterwauler McCrae' ],
@@ -163,8 +168,8 @@
     ]);
 
     $schema->populate('CD', [
-        [ qw/cdid artist title year/ ],
-        [ 1, 1, "Spoonful of bees", 1999 ],
+        [ qw/cdid artist title year genreid/ ],
+        [ 1, 1, "Spoonful of bees", 1999, 1 ],
         [ 2, 1, "Forkful of bees", 2001 ],
         [ 3, 1, "Caterwaulin' Blues", 1997 ],
         [ 4, 2, "Generic Manufactured Singles", 2001 ],
@@ -243,7 +248,7 @@
     
     $schema->populate('TreeLike', [
         [ qw/id parent name/ ],
-        [ 1, undef, 'root' ],        
+        [ 1, undef, 'root' ],
         [ 2, 1, 'foo'  ],
         [ 3, 2, 'bar'  ],
         [ 6, 2, 'blop' ],




More information about the Bast-commits mailing list