quote code supports multi-part idents
[scpubgit/Q-Branch.git] / t / dbic / show-progress.t
CommitLineData
13662f97 1use strict;
2use warnings;
3
4use Test::More;
aa2ae81e 5
6BEGIN {
13da332c 7 # ask for a recent DBIC version to skip the 5.6 tests as well
aa2ae81e 8 plan skip_all => 'Test temporarily requires DBIx::Class'
9 unless eval { require DBIx::Class::Storage::Statistics; DBIx::Class->VERSION('0.08124') };
13da332c 10
11 plan skip_all => 'Test does not properly work with the pre-0.082800 DBIC trials'
12 if DBIx::Class->VERSION =~ /^0.082700\d\d/;
aa2ae81e 13}
14
13662f97 15use DBIx::Class::Storage::Debug::PrettyPrint;
16
17my $cap;
18open my $fh, '>', \$cap;
19
20my $pp = DBIx::Class::Storage::Debug::PrettyPrint->new({
21 show_progress => 1,
22 clear_line => 'CLEAR',
23 executing => 'GOGOGO',
24});
25
26$pp->debugfh($fh);
27
28$pp->query_start('SELECT * FROM frew WHERE id = 1');
29is(
30 $cap,
31 qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGO),
32 'SQL Logged'
33);
34$pp->query_end('SELECT * FROM frew WHERE id = 1');
35is(
36 $cap,
37 qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGOCLEAR),
38 'SQL Logged'
39);
40
41done_testing;