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