sub run_tests {
my $schema = shift;
-plan tests => 41;
+plan tests => 43;
my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
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;
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');