Rename incorrectly named internal method (has nothing to do with MySQL)
[dbsrgits/DBIx-Class.git] / t / search / related_has_many.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use lib qw(t/lib);
7 use DBIC::SqlMakerTest;
8 use DBICTest;
9
10 my $schema = DBICTest->init_schema();
11
12 my $cd_rs = $schema->resultset('CD')->search ({ artist => { '!=', undef }});
13
14 # create some CDs without tracks
15 $cd_rs->create({ artist => 1, title => 'trackless_foo', year => 2010 });
16 $cd_rs->create({ artist => 1, title => 'trackless_bar', year => 2010 });
17
18 my $tr_count = $schema->resultset('Track')->count;
19
20 my $tr_rs = $cd_rs->search_related('tracks');
21
22
23 my @tracks;
24 while ($tr_rs->next) {
25   push @tracks, $_;
26 }
27
28 is (scalar @tracks, $tr_count, 'Iteration is correct');
29 is ($tr_rs->count, $tr_count, 'Count is correct');
30 is (scalar ($tr_rs->all), $tr_count, 'All is correct');
31
32 done_testing;