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