[Bast-commits] r6426 - DBIx-Class/0.08/trunk/t/delete

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Tue May 26 06:15:34 GMT 2009


Author: ribasushi
Date: 2009-05-26 06:15:34 +0000 (Tue, 26 May 2009)
New Revision: 6426

Modified:
   DBIx-Class/0.08/trunk/t/delete/related.t
Log:
TODOified test for RT#40701

Modified: DBIx-Class/0.08/trunk/t/delete/related.t
===================================================================
--- DBIx-Class/0.08/trunk/t/delete/related.t	2009-05-25 23:45:11 UTC (rev 6425)
+++ DBIx-Class/0.08/trunk/t/delete/related.t	2009-05-26 06:15:34 UTC (rev 6426)
@@ -4,12 +4,13 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 3;
+plan tests => 4;
 
 my $schema = DBICTest->init_schema();
 
 my $ars = $schema->resultset('Artist');
 my $cdrs = $schema->resultset('CD');
+my $cd2pr_rs = $schema->resultset('CD_to_Producer');
 
 # create some custom entries
 $ars->populate ([
@@ -18,6 +19,7 @@
   [qw/72        a2/],
   [qw/73        a3/],
 ]);
+
 $cdrs->populate ([
   [qw/cdid artist title   year/],
   [qw/70   71     delete0 2005/],
@@ -28,6 +30,13 @@
   [qw/75   73     delete5 2008/],
 ]);
 
+my $prod = $schema->resultset('Producer')->create ({ name => 'deleter' });
+my $prod_cd = $cdrs->find (70);
+my $cd2pr = $cd2pr_rs->create ({
+  producer => $prod,
+  cd => $prod_cd,
+});
+
 my $total_cds = $cdrs->count;
 
 # test that delete_related w/o conditions deletes all related records only
@@ -43,3 +52,10 @@
 # test that related deletion with limit condition works
 $a2_cds->search ({}, { rows => 1})->delete;
 is ($cdrs->count, $total_cds -= 1, 'related + limit delete ok');
+
+TODO: {
+  local $TODO = 'delete_related is based on search_related which is based on search which does not understand object arguments';
+  my $cd2pr_count = $cd2pr_rs->count;
+  $prod_cd->delete_related('cd_to_producer', { producer => $prod } );
+  is ($cd2pr_rs->count, $cd2pr_count -= 1, 'm2m link deleted succesfully');
+}




More information about the Bast-commits mailing list