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