File: complex.t

package info (click to toggle)
libdbix-class-perl 0.082844-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (40 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest->init_schema();
my $artist_rs = $schema->resultset ('Artist');

my $init_count = $artist_rs->count;
ok ($init_count, 'Some artists is database');

foreach my $delete_arg (
  [ { 'me.name' => 'foo' }, { 'me.name' => 'bar' } ],
  [ 'me.name' => 'foo', 'me.name' => 'bar' ],
) {
  $artist_rs->populate ([
    {
      name => 'foo',
    },
    {
      name => 'bar',
    }
  ]);

  is ($artist_rs->count, $init_count + 2, '2 Artists created');

  $artist_rs->search ({
   -and => [
    { 'me.artistid' => { '!=', undef } },
    $delete_arg,
   ],
  })->delete;

  is ($artist_rs->count, $init_count, 'Correct amount of artists deleted');
}

done_testing;