File: 09_no_modify_config.t

package info (click to toggle)
libdbix-class-schema-config-perl 0.001011-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 240 kB
  • ctags: 126
  • sloc: perl: 2,019; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 1,673 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
use warnings;
use strict;
use Test::More;
use DBIx::Class::Schema::Config;

{
    package Config::Any;

    $INC{"Config/Any.pm"} = __FILE__;
    
    sub load_stems {
        return [
            {
                'some_file' => { 
                    SOME_DATABASE => {
                        dsn => 'dbi:SQLite:dbfile=:memory:',
                        user => 'MyUser',
                        password => 'MyPass',
                    },
                    AWESOME_DB => {
                        dsn => 'dbi:mysql:dbname=epsilon', 
                        user => 'Bravo',
                        password => 'ShiJulIanDav',
                    },
                    OPTIONS => {
                        dsn => 'dbi:SQLite:dbfile=:memory:',
                        user => 'Happy',
                        password => 'User',
                        TRACE_LEVEL => 5,
                    }
                },
            },
            {
                'some_other_file' => {
                    SOME_DATABASE => {
                        dsn => 'dbi:mysql:dbname=acronym', 
                        user => 'YawnyPants',
                        password => 'WhyDoYouHateUs?',
                    },
                },
            }
        ]
    }
}

ok my $ref = DBIx::Class::Schema::Config->config;
is_deeply( $ref, "Config::Any"->load_stems, "Loaded correct data set." );

is $ref->[0]->{some_file} = undef, undef,  "Changed reference returned by config.";



is_deeply( 
    DBIx::Class::Schema::Config->config, 
    "Config::Any"->load_stems,
    "Changes to a ref of ::config's return does not change future invocations."
);


done_testing;