fixup for stringify that can be false in find_or_create_related
[dbsrgits/DBIx-Class.git] / t / run / 26might_have.tl
CommitLineData
8417f5ee 1sub run_tests {
2my $schema = shift;
3
4my $queries;
5#$schema->storage->debugfh(IO::File->new('t/var/temp.trace', 'w'));
6$schema->storage->debugcb( sub{ $queries++ } );
7
8eval "use DBD::SQLite";
9plan skip_all => 'needs DBD::SQLite for testing' if $@;
10plan tests => 2;
11
12
13my $cd = $schema->resultset("CD")->find(1);
14$cd->title('test');
15
16# SELECT count
17$queries = 0;
18$schema->storage->debug(1);
19
20$cd->update;
21
22is($queries, 1, 'liner_notes (might_have) not prefetched - do not load
23liner_notes on update');
24
25$schema->storage->debug(0);
26
27
28my $cd2 = $schema->resultset("CD")->find(2, {prefetch => 'liner_notes'});
29$cd2->title('test');
30
31# SELECT count
32$queries = 0;
33$schema->storage->debug(1);
34
35$cd2->update;
36
37is($queries, 1, 'liner_notes (might_have) prefetched - do not load
38liner_notes on update');
39
40$schema->storage->debug(0);
41}
42
431;