Commit | Line | Data |
9faec51a |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use lib 't/lib'; |
7 | use DBICDHTest; |
8 | use DBIx::Class::DeploymentHandler; |
9 | use aliased 'DBIx::Class::DeploymentHandler', 'DH'; |
10 | |
11 | use File::Path qw(remove_tree mkpath); |
12 | use Test::More; |
7b3d00f9 |
13 | use File::Temp 'tempdir'; |
9faec51a |
14 | use Test::Exception; |
15 | |
624e3018 |
16 | my $db = 'dbi:SQLite::memory:'; |
17 | my @connection = ($db, '', '', { ignore_version => 1, on_connect_do => sub { die }}); |
7b3d00f9 |
18 | my $sql_dir = tempdir( CLEANUP => 1 ); |
9faec51a |
19 | |
20 | VERSION1: { |
21 | use_ok 'DBICVersion_v1'; |
22 | my $s = DBICVersion::Schema->connect(@connection); |
23 | $DBICVersion::Schema::VERSION = 1; |
24 | ok($s, 'DBICVersion::Schema 1 instantiates correctly'); |
25 | ok !$s->storage->connected, 'creating schema did not connect'; |
26 | my $handler = DH->new({ |
91adde75 |
27 | script_directory => $sql_dir, |
9faec51a |
28 | schema => $s, |
29 | databases => 'SQLite', |
30 | sql_translator_args => { add_drop_table => 0 }, |
31 | }); |
32 | ok !$s->storage->connected, 'creating handler did not connect'; |
33 | ok($handler, 'DBIx::Class::DeploymentHandler w/1 instantiates correctly'); |
34 | |
7b3d00f9 |
35 | mkpath("$sql_dir/SQLite/initialize/1"); |
ff40cb1f |
36 | $handler->initialize({ version => 1, storage_type => 'SQLite' }); |
9faec51a |
37 | ok !$s->storage->connected, 'creating schema did not connect'; |
38 | } |
39 | done_testing; |