first cut of grep_cache feature
[dbsrgits/DBIx-Class.git] / t / dq / grep_cache.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6 use Test::Warn;
7 use lib qw(t/lib);
8 use DBICTest;
9 use DBIC::SqlMakerTest;
10 use Data::Query::ExprDeclare;
11
12 my $schema = DBICTest->init_schema();
13
14 my $cds = $schema->resultset('CD');
15
16 my $restricted = $cds->search({}, { cache => 1, grep_cache => 1 })
17                      ->search({ 'me.artist' => 1 });
18
19 is($restricted->count, 3, 'Count on restricted ok');
20
21 $restricted = $cds->search(
22                       {},
23                       { prefetch => 'artist', cache => 1, grep_cache => 1 }
24                     )
25                   ->search({ 'artist.name' => 'Caterwauler McCrae' });
26
27 is($restricted->count, 3, 'Count on restricted ok via join');
28
29 done_testing;