X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frun%2F01core.tl;h=0bc257aee0ca2cbc26a29fc9294c7016b65d7400;hb=b8d4bd90ba3f24ab649ece077bdcd72b26c9138f;hp=c41ef17a099515097ed22f792ed714e1d0472115;hpb=82a9670084516f29c0442b27b37e40b419addab6;p=dbsrgits%2FDBIx-Class.git diff --git a/t/run/01core.tl b/t/run/01core.tl index c41ef17..0bc257a 100644 --- a/t/run/01core.tl +++ b/t/run/01core.tl @@ -1,7 +1,7 @@ sub run_tests { my $schema = shift; -plan tests => 41; +plan tests => 43; my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'}); @@ -144,7 +144,8 @@ my $rel_rs = $tag_rs->search_related('cd'); cmp_ok($rel_rs->count, '==', 5, 'Related search ok'); cmp_ok($or_rs->next->cdid, '==', $rel_rs->next->cdid, 'Related object ok'); - +$or_rs->reset; +$rel_rs->reset; my $tag = $schema->resultset('Tag')->search( [ { 'me.tag' => 'Blue' } ], { cols=>[qw/tagid/] } )->next; @@ -154,6 +155,12 @@ cmp_ok($tag->has_column_loaded('tag'), '==', 0, 'Has not tag loaded'); ok($schema->storage(), 'Storage available'); +#test cascade_delete thru many_many relations +my $art_del = $schema->resultset("Artist")->find({ artistid => 1 }); +$art_del->delete; +cmp_ok( $schema->resultset("CD")->search({artist => 1}), '==', 0, 'Cascading through has_many top level.'); +cmp_ok( $schema->resultset("CD_to_Producer")->search({cd => 1}), '==', 0, 'Cascading through has_many children.'); + $schema->source("Artist")->{_columns}{'artistid'} = {}; my $typeinfo = $schema->source("Artist")->column_info('artistid');