cascading delete on a nonexistent relation should warn instead of
[dbsrgits/DBIx-Class.git] / t / delete / cascade_missing.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Warn;
6 use Test::Exception;
7
8 use lib 't/lib';
9 use DBICTest;
10
11 my $schema = DBICTest->init_schema();
12 $schema->_unregister_source('CD');
13
14 warnings_like {
15   lives_ok {
16     $_->delete for $schema->resultset('Artist')->all;
17   } 'delete on rows with dangling rels lives';
18 } [
19   # 12 == 3 artists * failed cascades:
20   #   cds
21   #   cds_unordered
22   #   cds_very_very_very_long_relationship_name
23   (qr/skipping cascad/i) x 9
24 ], 'got warnings about cascading deletes';
25
26 done_testing;
27