[Bast-commits] r4723 - in DBIx-Class-Preview/1.000/trunk:
lib/DBIx/Class/ResultSource/Table lib/DBIx/Class/Schema t t/var
lukes at dev.catalyst.perl.org
lukes at dev.catalyst.perl.org
Sat Aug 2 12:02:55 BST 2008
Author: lukes
Date: 2008-08-02 12:02:55 +0100 (Sat, 02 Aug 2008)
New Revision: 4723
Added:
DBIx-Class-Preview/1.000/trunk/t/delete.t
Modified:
DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Previewed.pm
DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/Schema/Preview.pm
DBIx-Class-Preview/1.000/trunk/t/var/DBIxClass.db
Log:
added test for delete
Modified: DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Previewed.pm
===================================================================
--- DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Previewed.pm 2008-08-02 10:45:30 UTC (rev 4722)
+++ DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/ResultSource/Table/Previewed.pm 2008-08-02 11:02:55 UTC (rev 4723)
@@ -17,7 +17,8 @@
name => 'top_100_batch_preview',
_relationships => Storable::dclone( $self->_relationships ),
});
- $new_source->add_column('dirty' => { data_type => 'integer', default_value => 1 });
+ $new_source->add_column('dirty' => { data_type => 'integer', default_value => 0 });
+ $new_source->add_column('deleted' => { data_type => 'integer', default_value => 0 });
$new_source->preview_table($self->from . '_preview');
$new_source->relationship_info($_)->{attrs}{cascade_delete} = 0
for $new_source->relationships;
Modified: DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/Schema/Preview.pm
===================================================================
--- DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/Schema/Preview.pm 2008-08-02 10:45:30 UTC (rev 4722)
+++ DBIx-Class-Preview/1.000/trunk/lib/DBIx/Class/Schema/Preview.pm 2008-08-02 11:02:55 UTC (rev 4723)
@@ -64,7 +64,7 @@
}
}
$dirty_previewed_rs->update({ dirty => 0 });
- }
+ }
}
}
);
Added: DBIx-Class-Preview/1.000/trunk/t/delete.t
===================================================================
--- DBIx-Class-Preview/1.000/trunk/t/delete.t (rev 0)
+++ DBIx-Class-Preview/1.000/trunk/t/delete.t 2008-08-02 11:02:55 UTC (rev 4723)
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use DBICTest;
+use Test::More 'no_plan';
+
+my $schema = DBICTest->init_schema;
+$schema->preview_active(1);
+my $unpreviewed_schema = $schema->unpreviewed;
+my $row = $schema->resultset('Artist')->first;
+ok($row, 'got an artist row');
+my $orig_row = $unpreviewed_schema->resultset('Artist')->find($row->id);
+
+$row->delete;
+ok(!$schema->resultset('Artist')->find($row->id), 'artist no longer visible in previewed table');
+ok($unpreviewed_schema->resultset('Artist')->find($row->id), 'artist still visible in unpreviewed table');
+
+$schema->publish;
+
+ok(!$schema->resultset('Artist')->find($row->id), 'artist still not visible in previewed table');
+ok(!$unpreviewed_schema->resultset('Artist')->find($row->id), 'artist now not visible in unpreviewed table');
Modified: DBIx-Class-Preview/1.000/trunk/t/var/DBIxClass.db
===================================================================
(Binary files differ)
More information about the Bast-commits
mailing list