failing (crashing, really) test for this strange pg thing. could not figure out...
[dbsrgits/DBIx-Class.git] / t / 86might_have.t
CommitLineData
70350518 1use strict;
2use warnings;
3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
a47e1233 8my $schema = DBICTest->init_schema();
8417f5ee 9
10my $queries;
8417f5ee 11$schema->storage->debugcb( sub{ $queries++ } );
a2287768 12my $sdebug = $schema->storage->debug;
8417f5ee 13
8417f5ee 14plan tests => 2;
15
8417f5ee 16my $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
25is($queries, 1, 'liner_notes (might_have) not prefetched - do not load
26liner_notes on update');
27
a2287768 28$schema->storage->debug($sdebug);
8417f5ee 29
30
31my $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
40is($queries, 1, 'liner_notes (might_have) prefetched - do not load
41liner_notes on update');
42
a2287768 43$schema->storage->debug($sdebug);