672d635a96c6cf331bd1b257eb86fc7e6e97917e
[dbsrgits/SQL-Abstract.git] / t / dbic / show-progress.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use DBIx::Class::Storage::Debug::PrettyPrint;
6
7 my $cap;
8 open my $fh, '>', \$cap;
9
10 my $pp = DBIx::Class::Storage::Debug::PrettyPrint->new({
11    show_progress => 1,
12    clear_line    => 'CLEAR',
13    executing     => 'GOGOGO',
14 });
15
16 $pp->debugfh($fh);
17
18 $pp->query_start('SELECT * FROM frew WHERE id = 1');
19 is(
20    $cap,
21    qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGO),
22    'SQL Logged'
23 );
24 $pp->query_end('SELECT * FROM frew WHERE id = 1');
25 is(
26    $cap,
27    qq(SELECT * FROM frew WHERE id = 1 : \nGOGOGOCLEAR),
28    'SQL Logged'
29 );
30
31 done_testing;