Commit | Line | Data |
70350518 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
a47e1233 |
8 | my $schema = DBICTest->init_schema(); |
8417f5ee |
9 | |
10 | my $queries; |
8417f5ee |
11 | $schema->storage->debugcb( sub{ $queries++ } ); |
a2287768 |
12 | my $sdebug = $schema->storage->debug; |
8417f5ee |
13 | |
8417f5ee |
14 | plan tests => 2; |
15 | |
8417f5ee |
16 | my $cd = $schema->resultset("CD")->find(1); |
17 | $cd->title('test'); |
18 | |
19 | # SELECT count |
20 | $queries = 0; |
21 | $schema->storage->debug(1); |
22 | |
23 | $cd->update; |
24 | |
25 | is($queries, 1, 'liner_notes (might_have) not prefetched - do not load |
26 | liner_notes on update'); |
27 | |
a2287768 |
28 | $schema->storage->debug($sdebug); |
8417f5ee |
29 | |
30 | |
31 | my $cd2 = $schema->resultset("CD")->find(2, {prefetch => 'liner_notes'}); |
50f18b6b |
32 | $cd2->title('test2'); |
8417f5ee |
33 | |
34 | # SELECT count |
35 | $queries = 0; |
36 | $schema->storage->debug(1); |
37 | |
38 | $cd2->update; |
39 | |
40 | is($queries, 1, 'liner_notes (might_have) prefetched - do not load |
41 | liner_notes on update'); |
42 | |
a2287768 |
43 | $schema->storage->debug($sdebug); |