[Bast-commits] r7861 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class t t/relationship

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Nov 12 00:40:16 GMT 2009


Author: ribasushi
Date: 2009-11-12 00:40:14 +0000 (Thu, 12 Nov 2009)
New Revision: 7861

Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/trunk/t/60core.t
   DBIx-Class/0.08/trunk/t/79aliasing.t
   DBIx-Class/0.08/trunk/t/80unique.t
   DBIx-Class/0.08/trunk/t/relationship/core.t
Log:
Fix return value of in_storage

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2009-11-12 00:35:36 UTC (rev 7860)
+++ DBIx-Class/0.08/trunk/Changes	2009-11-12 00:40:14 UTC (rev 7861)
@@ -32,6 +32,7 @@
         - Improvements to populate's handling of mixed scalarref values
         - Fixed regression losing result_class after $rs->find (introduced
           in 0.08108)
+        - Fix in_storage() to return 1|0 as per existing documentation
         - POD improvements
 
 0.08112 2009-09-21 10:57:00 (UTC)

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2009-11-12 00:35:36 UTC (rev 7860)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2009-11-12 00:40:14 UTC (rev 7861)
@@ -424,7 +424,7 @@
 sub in_storage {
   my ($self, $val) = @_;
   $self->{_in_storage} = $val if @_ > 1;
-  return $self->{_in_storage};
+  return $self->{_in_storage} ? 1 : 0;
 }
 
 =head2 update

Modified: DBIx-Class/0.08/trunk/t/60core.t
===================================================================
--- DBIx-Class/0.08/trunk/t/60core.t	2009-11-12 00:35:36 UTC (rev 7860)
+++ DBIx-Class/0.08/trunk/t/60core.t	2009-11-12 00:40:14 UTC (rev 7861)
@@ -65,7 +65,7 @@
 
 is(@art, 2, 'And then there were two');
 
-ok(!$art->in_storage, "It knows it's dead");
+is($art->in_storage, 0, "It knows it's dead");
 
 dies_ok ( sub { $art->delete }, "Can't delete twice");
 
@@ -144,7 +144,7 @@
   });
 
   is($new_obj->name, 'find_or_new', 'find_or_new: instantiated a new artist');
-  ok(! $new_obj->in_storage, 'new artist is not in storage');
+  is($new_obj->in_storage, 0, 'new artist is not in storage');
 }
 
 my $cd = $schema->resultset("CD")->find(1);

Modified: DBIx-Class/0.08/trunk/t/79aliasing.t
===================================================================
--- DBIx-Class/0.08/trunk/t/79aliasing.t	2009-11-12 00:35:36 UTC (rev 7860)
+++ DBIx-Class/0.08/trunk/t/79aliasing.t	2009-11-12 00:40:14 UTC (rev 7861)
@@ -52,7 +52,7 @@
   my $cd_rs = $schema->resultset('CD')->search({ 'artist.name' => 'Caterwauler McCrae' }, { join => 'artist' });
 
   my $cd = $cd_rs->find_or_new({ title => 'Huh?', year => 2006 });
-  ok(! $cd->in_storage, 'new CD not in storage yet');
+  is($cd->in_storage, 0, 'new CD not in storage yet');
   is($cd->title, 'Huh?', 'new CD title is correct');
   is($cd->year, 2006, 'new CD year is correct');
 }

Modified: DBIx-Class/0.08/trunk/t/80unique.t
===================================================================
--- DBIx-Class/0.08/trunk/t/80unique.t	2009-11-12 00:35:36 UTC (rev 7860)
+++ DBIx-Class/0.08/trunk/t/80unique.t	2009-11-12 00:40:14 UTC (rev 7861)
@@ -195,7 +195,7 @@
       { key => 'cd_artist_title' }
     );
 
-    ok(!$cd1->in_storage, 'CD is not in storage yet after update_or_new');
+    is($cd1->in_storage, 0, 'CD is not in storage yet after update_or_new');
     $cd1->insert;
     ok($cd1->in_storage, 'CD got added to strage after update_or_new && insert');
 

Modified: DBIx-Class/0.08/trunk/t/relationship/core.t
===================================================================
--- DBIx-Class/0.08/trunk/t/relationship/core.t	2009-11-12 00:35:36 UTC (rev 7860)
+++ DBIx-Class/0.08/trunk/t/relationship/core.t	2009-11-12 00:40:14 UTC (rev 7861)
@@ -133,7 +133,7 @@
   year => 2007,
 } );
 is( $cd->title, 'Greatest Hits 2: Louder Than Ever', 'find_or_new_related new record ok' );
-ok( ! $cd->in_storage, 'find_or_new_related on a new record: not in_storage' );
+is( $cd->in_storage, 0, 'find_or_new_related on a new record: not in_storage' );
 
 $cd->artist(undef);
 my $newartist = $cd->find_or_new_related( 'artist', {




More information about the Bast-commits mailing list