Commit | Line | Data |
8d2da21a |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
8 | my $schema = DBICTest->init_schema(); |
9 | |
10 | my $new_artist = $schema->resultset('Artist')->create({ name => 'new kid behind the block' }); |
11 | |
12 | # see how many cds do we have, and relink them all to the new guy |
13 | my $cds = $schema->resultset('CD'); |
14 | my $cds_count = $cds->count; |
15 | cmp_ok($cds_count, '>', 0, 'have some cds'); |
16 | |
17 | $cds->update_all({ artist => $new_artist }); |
18 | |
19 | is( $new_artist->cds->count, $cds_count, 'All cds properly relinked'); |
20 | |
21 | done_testing; |