X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F86might_have.t;h=05ba5390dbdbe8d207502563a235426a55260b37;hb=777738d07cfd6055a4f40b944a69329c6995df9a;hp=c1a66dee5b2c9a69dc8eb4a83b363a16259a5ca8;hpb=8273e845426f0187b4ad6c4a1b42286fa09a648f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/86might_have.t b/t/86might_have.t index c1a66de..05ba539 100644 --- a/t/86might_have.t +++ b/t/86might_have.t @@ -8,38 +8,31 @@ use DBICTest; my $schema = DBICTest->init_schema(); -my $queries; -$schema->storage->debugcb( sub{ $queries++ } ); -my $sdebug = $schema->storage->debug; - my $cd = $schema->resultset("CD")->find(1); $cd->title('test'); -# SELECT count -$queries = 0; -$schema->storage->debug(1); - -$cd->update; - -is($queries, 1, 'liner_notes (might_have) not prefetched - do not load -liner_notes on update'); - -$schema->storage->debug($sdebug); - +$schema->is_executed_querycount( sub { + $cd->update; +}, { + BEGIN => 1, + UPDATE => 1, + COMMIT => 1, +}, 'liner_notes (might_have) not prefetched - do not load liner_notes on update' ); my $cd2 = $schema->resultset("CD")->find(2, {prefetch => 'liner_notes'}); $cd2->title('test2'); -# SELECT count -$queries = 0; -$schema->storage->debug(1); - -$cd2->update; - -is($queries, 1, 'liner_notes (might_have) prefetched - do not load -liner_notes on update'); +$schema->is_executed_querycount( sub { + $cd2->update; +}, { + BEGIN => 1, + UPDATE => 1, + COMMIT => 1, +}, 'liner_notes (might_have) prefetched - do not load liner_notes on update'); warning_like { + local $ENV{DBIC_DONT_VALIDATE_RELS}; + DBICTest::Schema::Bookmark->might_have( linky => 'DBICTest::Schema::Link', { "foreign.id" => "self.link" }, @@ -60,5 +53,4 @@ warning_like { 'Setting DBIC_DONT_VALIDATE_RELS suppresses nullable relation warnings'; } -$schema->storage->debug($sdebug); done_testing();