Another count() quirk down
[dbsrgits/DBIx-Class.git] / t / count / search_related.t
CommitLineData
5978a0e8 1use strict;
2use warnings;
3
4use Test::More;
5
6use lib qw(t/lib);
7
8use DBICTest;
9
10my $schema = DBICTest->init_schema();
11my $cd_rs = $schema->resultset('CD')->search ({}, { rows => 1, order_by => 'cdid' });
12
13my $track_count = $cd_rs->first->tracks->count;
14
15cmp_ok ($track_count, '>', 1, 'First CD has several tracks');
16
17is ($cd_rs->search_related ('tracks')->count, $track_count, 'related->count returns correct number');
18is (scalar ($cd_rs->search_related ('tracks')->all), $track_count, 'related->all returns correct number of objects');
19
20done_testing;