Better exception when things get really really bad with prepare()
[dbsrgits/DBIx-Class.git] / t / storage / dbic_pretty.t
1 use strict;
2 use warnings;
3 use lib qw(t/lib);
4 use DBICTest;
5 use Test::More;
6
7 BEGIN {
8     require DBIx::Class;
9     plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_prettydebug')
10       unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_prettydebug');
11 }
12
13 BEGIN { delete @ENV{qw(DBIC_TRACE_PROFILE)} }
14
15 {
16    my $schema = DBICTest->init_schema;
17
18    isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Statistics');
19 }
20
21 {
22    local $ENV{DBIC_TRACE_PROFILE} = 'console';
23
24    my $schema = DBICTest->init_schema;
25
26    isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Debug::PrettyPrint');;
27    is($schema->storage->debugobj->_sqlat->indent_string, ' ', 'indent string set correctly from console profile');
28 }
29
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;