Merge 'null_column_regression' into 'trunk'
[dbsrgits/DBIx-Class.git] / t / resultset / nulls_only.t
1 use strict;
2 use warnings;
3
4 use lib qw(t/lib);
5 use Test::More;
6 use Test::Exception;
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11
12 my $cd_rs = $schema->resultset('CD')->search ({ genreid => undef }, { columns => [ 'genreid' ]} );
13 my $count = $cd_rs->count;
14 cmp_ok ( $count, '>', 1, 'several CDs with no genre');
15
16 my @objects = $cd_rs->all;
17 is (scalar @objects, $count, 'Correct amount of objects without limit');
18 isa_ok ($_, 'DBICTest::CD') for @objects;
19
20 is_deeply (
21   [ map { values %{{$_->get_columns}} } (@objects) ],
22   [ (undef) x $count ],
23   'All values are indeed undef'
24 );
25
26
27 isa_ok ($cd_rs->search ({}, { rows => 1 })->single, 'DBICTest::CD');
28
29 done_testing;