DBIC_TRACE_PROFILE
[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
14$artist_rs->populate ([
15 {
16 name => 'foo',
17 },
18 {
19 name => 'bar',
20 }
21]);
22
23is ($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
32is ($artist_rs->count, $init_count, 'Correct amount of artists deleted');
33
34done_testing;
35