Fix bug reported by tommyt
[dbsrgits/DBIx-Class.git] / t / delete / complex.t
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 my $artist_rs = $schema->resultset ('Artist');
10
11 my $init_count = $artist_rs->count;
12 ok ($init_count, 'Some artists is database');
13
14 $artist_rs->populate ([
15   {
16     name => 'foo',
17   },
18   {
19     name => 'bar',
20   }
21 ]);
22
23 is ($artist_rs->count, $init_count + 2, '2 Artists created');
24
25 $artist_rs->search ({
26  -and => [
27   { 'me.artistid' => { '!=', undef } },
28   [ { 'me.name' => 'foo' }, { 'me.name' => 'bar' } ],
29  ],
30 })->delete;
31
32 is ($artist_rs->count, $init_count, 'Correct amount of artists deleted');
33
34 done_testing;
35