File: nulls_only.t

package info (click to toggle)
libdbix-class-perl 0.082810-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,012 kB
  • ctags: 2,157
  • sloc: perl: 26,390; sql: 322; makefile: 10
file content (28 lines) | stat: -rw-r--r-- 653 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
use strict;
use warnings;

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

my $schema = DBICTest->init_schema();


my $cd_rs = $schema->resultset('CD')->search ({ genreid => undef }, { columns => [ 'genreid' ]} );
my $count = $cd_rs->count;
cmp_ok ( $count, '>', 1, 'several CDs with no genre');

my @objects = $cd_rs->all;
is (scalar @objects, $count, 'Correct amount of objects without limit');
isa_ok ($_, 'DBICTest::CD') for @objects;

is_deeply (
  [ map { values %{{$_->get_columns}} } (@objects) ],
  [ (undef) x $count ],
  'All values are indeed undef'
);


isa_ok ($cd_rs->search ({}, { rows => 1 })->single, 'DBICTest::CD');

done_testing;