File: false_colvalues.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 (34 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (5)
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
use warnings;
use strict;

use Test::More;
use Test::Deep;

use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest->init_schema( no_populate => 1 );

$schema->resultset('CD')->create({
  cdid => 0, title => '', year => 0, genreid => 0, single_track => 0, artist => {
    artistid => 0, name => '', rank => 0, charfield => 0,
  },
});

$schema->is_executed_querycount( sub {
  my $cd = $schema->resultset('CD')->search( {}, { prefetch => 'artist' })->next;

  cmp_deeply
    { $cd->get_columns },
    { artist => 0, cdid => 0, genreid => 0, single_track => 0, title => '', year => 0 },
    'Expected CD columns present',
  ;

  cmp_deeply
    { $cd->artist->get_columns },
    { artistid => 0, charfield => 0, name => "", rank => 0 },
    'Expected Artist columns present',
  ;
}, 1, 'Only one query fired - prefetch worked' );

done_testing;