Deprecate emulate_limit() - can not be sanely supported by DQ
[dbsrgits/DBIx-Class.git] / t / delete / complex.t
CommitLineData
037e8dca 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
61f031bf 14foreach my $delete_arg (
037e8dca 15 [ { 'me.name' => 'foo' }, { 'me.name' => 'bar' } ],
61f031bf 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}
037e8dca 38
39done_testing;
40