This code belogs in Storage::DBI
[dbsrgits/DBIx-Class-Historic.git] / t / 104view.t
CommitLineData
bccd177f 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Exception;
6use lib qw(t/lib);
7use DBICTest;
8
9my $schema = DBICTest->init_schema();
10
1ee9aa72 11plan tests => 2;
bccd177f 12
1ee9aa72 13## Real view
3a8d32fa 14my $cds_rs_2000 = $schema->resultset('CD')->search( { year => 2000 });
bccd177f 15my $year2kcds_rs = $schema->resultset('Year2000CDs');
16
3a8d32fa 17is($cds_rs_2000->count, $year2kcds_rs->count, 'View Year2000CDs sees all CDs in year 2000');
bccd177f 18
19
1ee9aa72 20## Virtual view
3a8d32fa 21my $cds_rs_1999 = $schema->resultset('CD')->search( { year => 1999 });
1ee9aa72 22my $year1999cds_rs = $schema->resultset('Year1999CDs');
23
3a8d32fa 24is($cds_rs_1999->count, $year1999cds_rs->count, 'View Year1999CDs sees all CDs in year 1999');
1ee9aa72 25
26
27
bccd177f 28