Disable dbic-tests when no dbic is present
[dbsrgits/SQL-Abstract.git] / t / dbic / show-progress.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 BEGIN {
7   # ask for a recent DBIC version to skip the 5.6.2 tests as well
8   plan skip_all => 'Test temporarily requires DBIx::Class'
9     unless eval { require DBIx::Class::Storage::Statistics; DBIx::Class->VERSION('0.08124') };
10 }
11
12 use DBIx::Class::Storage::Debug::PrettyPrint;
13
14 my $cap;
15 open my $fh, '>', \$cap;
16
17 my $pp = DBIx::Class::Storage::Debug::PrettyPrint->new({
18    show_progress => 1,
19    clear_line    => 'CLEAR',
20    executing     => 'GOGOGO',
21 });
22
23 $pp->debugfh($fh);
24
25 $pp->query_start('SELECT * FROM frew WHERE id = 1');
26 is(
27    $cap,
28    qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGO),
29    'SQL Logged'
30 );
31 $pp->query_end('SELECT * FROM frew WHERE id = 1');
32 is(
33    $cap,
34    qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGOCLEAR),
35    'SQL Logged'
36 );
37
38 done_testing;