File: 05_integration_plugin.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 (52 lines) | stat: -rw-r--r-- 1,827 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
#!/usr/bin/perl
use warnings;
use strict;
use Test::More;
use lib 't/lib'; # Tests above t/
use lib 'lib';   # Tests inside t/
use DBIx::Class::Schema::Config::Plugin;

# Using a config file.
ok my $Schema1 = DBIx::Class::Schema::Config::Plugin->connect('TEST'),
    "Can connect to the Test Schema.";

ok $Schema1->storage->dbh->do( "CREATE TABLE hash ( key text, value text )" ),
    "Can create table against the raw dbh.";

ok $Schema1->resultset('Hash')->create( { key => "Dr", value => "Spaceman" } ),
    "Can write to the Test Schema.";

is $Schema1->resultset('Hash')->find( { key => 'Dr' }, { key => 'key_unique' } )->value, 'Spaceman',
    "Can read from the Test Schema.";

# Pass through of array.
ok my $Schema2 = DBIx::Class::Schema::Config::Plugin->connect('dbi:SQLite:dbname=:memory:', '', ''),
    "Can connect to the Test Schema.";

ok $Schema2->storage->dbh->do( "CREATE TABLE hash ( key text, value text )" ),
    "Can create table against the raw dbh.";

ok $Schema2->resultset('Hash')->create( { key => "Dr", value => "Spaceman" } ),
    "Can write to the Test Schema.";

is $Schema2->resultset('Hash')->find( { key => 'Dr' }, { key => 'key_unique' } )->value, 'Spaceman',
    "Can read from the Test Schema.";
    
# Pass through of hash
ok my $Schema3 = DBIx::Class::Schema::Config::Plugin->connect({ dsn => 'dbi:SQLite:dbname=:memory:' }),
    "Can connect to the Test Schema.";

ok $Schema3->storage->dbh->do( "CREATE TABLE hash ( key text, value text )" ),
    "Can create table against the raw dbh.";

ok $Schema3->resultset('Hash')->create( { key => "Dr", value => "Spaceman" } ),
    "Can write to the Test Schema.";

is $Schema3->resultset('Hash')->find( { key => 'Dr' }, { key => 'key_unique' } )->value, 'Spaceman',
    "Can read from the Test Schema.";
    
    
    
    
    
done_testing;