Commit | Line | Data |
c0329273 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
2 | |
037e8dca |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
c0329273 |
7 | |
037e8dca |
8 | use DBICTest; |
9 | |
10 | my $schema = DBICTest->init_schema(); |
11 | my $artist_rs = $schema->resultset ('Artist'); |
12 | |
13 | my $init_count = $artist_rs->count; |
14 | ok ($init_count, 'Some artists is database'); |
15 | |
61f031bf |
16 | foreach my $delete_arg ( |
037e8dca |
17 | [ { 'me.name' => 'foo' }, { 'me.name' => 'bar' } ], |
61f031bf |
18 | [ 'me.name' => 'foo', 'me.name' => 'bar' ], |
19 | ) { |
20 | $artist_rs->populate ([ |
21 | { |
22 | name => 'foo', |
23 | }, |
24 | { |
25 | name => 'bar', |
26 | } |
27 | ]); |
28 | |
29 | is ($artist_rs->count, $init_count + 2, '2 Artists created'); |
30 | |
31 | $artist_rs->search ({ |
32 | -and => [ |
33 | { 'me.artistid' => { '!=', undef } }, |
34 | $delete_arg, |
35 | ], |
36 | })->delete; |
37 | |
38 | is ($artist_rs->count, $init_count, 'Correct amount of artists deleted'); |
39 | } |
037e8dca |
40 | |
41 | done_testing; |
42 | |