Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / storage / dbic_pretty.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2 use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_prettydebug';
3
4 use strict;
5 use warnings;
6
7
8 use DBICTest;
9 use Test::More;
10
11 BEGIN { delete @ENV{qw(DBIC_TRACE_PROFILE)} }
12
13 {
14    my $schema = DBICTest->init_schema;
15
16    isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Statistics');
17 }
18
19 {
20    local $ENV{DBIC_TRACE_PROFILE} = 'console';
21
22    my $schema = DBICTest->init_schema;
23
24    isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Debug::PrettyPrint');;
25    is($schema->storage->debugobj->_sqlat->indent_string, ' ', 'indent string set correctly from console profile');
26 }
27
28 SKIP:{
29    DBIx::Class::Optional::Dependencies->skip_without('config_file_reader' );
30
31    local $ENV{DBIC_TRACE_PROFILE} = './t/lib/awesome.json';
32
33    my $schema = DBICTest->init_schema;
34
35    isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Debug::PrettyPrint');;
36    is($schema->storage->debugobj->_sqlat->indent_string, 'frioux', 'indent string set correctly from file-based profile');
37 }
38
39 done_testing;