[Bast-commits] r9589 - DBIx-Class-Journal/1.000/trunk/t

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Thu Jun 24 02:05:24 GMT 2010


Author: frew
Date: 2010-06-24 03:05:24 +0100 (Thu, 24 Jun 2010)
New Revision: 9589

Modified:
   DBIx-Class-Journal/1.000/trunk/t/03populate.t
Log:
fix bogus tests

Modified: DBIx-Class-Journal/1.000/trunk/t/03populate.t
===================================================================
--- DBIx-Class-Journal/1.000/trunk/t/03populate.t	2010-06-23 15:34:43 UTC (rev 9588)
+++ DBIx-Class-Journal/1.000/trunk/t/03populate.t	2010-06-24 02:05:24 UTC (rev 9589)
@@ -6,7 +6,7 @@
     eval "use DBD::SQLite; use SQL::Translator";
     plan $@
         ? ( skip_all => 'needs DBD::SQLite and SQL::Translator for testing' )
-        : ( tests => 17 );
+        : ( tests => 11 );
 }
 
 use lib qw(t/lib);
@@ -28,17 +28,14 @@
 like( $e, qr/table.*changelog/, 'missing table error' );
 
 # insert two rows -not- in txn
-my ($artistA, $artistB);
-#$schema->txn_do(sub {
-    $artistA = $schema->resultset('Artist')->create({
-        name => 'Fred Bloggs A',
-    });
+$schema->storage->dbh_do(sub {
+   my $dbh = $_[1];
+   $dbh->do($_) for (
+     "INSERT INTO artist ( name ) VALUES ('Fred Bloggs A' )",
+     "INSERT INTO artist ( name ) VALUES ('Fred Bloggs B' )"
+   );
+});
 
-    $artistB = $schema->resultset('Artist')->create({
-        name => 'Fred Bloggs B',
-    });
-#});
-
 # create the journal
 $schema->journal_schema_deploy();
 
@@ -69,31 +66,3 @@
 is( $@, '', "no error" );
 is( $count, 2, "count is 2 (auditlog)" );
 
-# now delete a row
-eval {
-    my $deleted = $schema->txn_do(sub {
-        $artistA->delete;
-    });
-};
-
-is( $@, '', "no error from deletion journal (create_id not null)" );
-is( $artistA->in_storage, 0, "row was deleted" );
-
-# check journal log still has two rows
-$count = eval { $schema->_journal_schema->resultset('ArtistAuditLog')->count };
-
-is( $@, '', "no error" );
-is( $count, 2, "count is 2 (auditlog 2)" );
-
-# and that one of them has a delete_id
-$count = eval {
-    $schema->_journal_schema->resultset('ArtistAuditLog')
-        ->search({
-            artistid => $artistA->id,
-            delete_id => { '-not' => undef }
-        })->count;
-};
-
-is( $@, '', "no error" );
-is( $count, 1, "count is 1 (delete_id)" );
-




More information about the Bast-commits mailing list