Expand annotations to cover all generated methods
[dbsrgits/DBIx-Class.git] / t / search / related_has_many.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
31a8aaaf 3use strict;
4use warnings;
5
6use Test::More;
7
c0329273 8
31a8aaaf 9use DBICTest;
10
11my $schema = DBICTest->init_schema();
12
13my $cd_rs = $schema->resultset('CD')->search ({ artist => { '!=', undef }});
14
15# create some CDs without tracks
16$cd_rs->create({ artist => 1, title => 'trackless_foo', year => 2010 });
17$cd_rs->create({ artist => 1, title => 'trackless_bar', year => 2010 });
18
19my $tr_count = $schema->resultset('Track')->count;
20
21my $tr_rs = $cd_rs->search_related('tracks');
22
23
24my @tracks;
25while ($tr_rs->next) {
26 push @tracks, $_;
27}
28
29is (scalar @tracks, $tr_count, 'Iteration is correct');
30is ($tr_rs->count, $tr_count, 'Count is correct');
31is (scalar ($tr_rs->all), $tr_count, 'All is correct');
32
33done_testing;