Restore ability to handle underdefined root (t/prefetch/incomplete.t)
[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 DBICTest;
7
8 my $schema = DBICTest->init_schema();
9
10
11 my $cd_rs = $schema->resultset('CD')->search ({ genreid => undef }, { columns => [ 'genreid' ]} );
12 my $count = $cd_rs->count;
13 cmp_ok ( $count, '>', 1, 'several CDs with no genre');
14
15 my @objects = $cd_rs->all;
16 is (scalar @objects, $count, 'Correct amount of objects without limit');
17 isa_ok ($_, 'DBICTest::CD') for @objects;
18
19 is_deeply (
20   [ map { values %{{$_->get_columns}} } (@objects) ],
21   [ (undef) x $count ],
22   'All values are indeed undef'
23 );
24
25
26 isa_ok ($cd_rs->search ({}, { rows => 1 })->single, 'DBICTest::CD');
27
28 done_testing;