Commit | Line | Data |
24794769 |
1 | #!perl |
2 | |
3 | use Test::More; |
4 | use Test::Exception; |
5 | |
6 | use lib 't/lib'; |
02d58ac0 |
7 | use DBICDHTest; |
24794769 |
8 | use DBICTest; |
b539a216 |
9 | use aliased |
10 | 'DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions'; |
24794769 |
11 | |
24794769 |
12 | { |
b539a216 |
13 | my $vh = DatabaseToSchemaVersions->new({ |
24794769 |
14 | to_version => '5.0', |
b539a216 |
15 | database_version => '1.0', |
16 | schema_version => '1.0', |
24794769 |
17 | }); |
18 | |
19 | ok( $vh, 'VersionHandler gets instantiated' ); |
b539a216 |
20 | ok( |
21 | eq_array( $vh->next_version_set, [qw( 1.0 5.0 )] ), |
22 | 'db version and to_version get correctly put into version set' |
23 | ); |
24794769 |
24 | ok( !$vh->next_version_set, 'next_version_set only works once'); |
25 | ok( !$vh->next_version_set, 'seriously.'); |
26 | } |
27 | |
28 | { |
b539a216 |
29 | my $vh = DatabaseToSchemaVersions->new({ |
30 | database_version => '1.0', |
31 | schema_version => '1.0', |
24794769 |
32 | }); |
33 | |
34 | ok( $vh, 'VersionHandler gets instantiated' ); |
b539a216 |
35 | ok( |
36 | !$vh->next_version_set, |
37 | 'VersionHandler is null when schema_version and db_verison are the same' |
38 | ); |
24794769 |
39 | } |
40 | |
41 | { |
b539a216 |
42 | my $vh = DatabaseToSchemaVersions->new({ |
43 | database_version => '1.0', |
44 | schema_version => '1.0', |
24794769 |
45 | }); |
46 | |
47 | ok( $vh, 'VersionHandler gets instantiated' ); |
b539a216 |
48 | ok( |
49 | !$vh->next_version_set, |
50 | 'VersionHandler is null when schema_version and db_verison are the same' |
51 | ); |
24794769 |
52 | } |
53 | |
54 | { |
b539a216 |
55 | my $vh = DatabaseToSchemaVersions->new({ |
56 | database_version => '1.0', |
57 | schema_version => '10.0', |
24794769 |
58 | }); |
59 | |
60 | ok( $vh, 'VersionHandler gets instantiated' ); |
b539a216 |
61 | ok( |
62 | eq_array( $vh->next_version_set, [qw( 1.0 10.0 )] ), |
63 | 'db version and schema version get correctly put into version set' |
64 | ); |
24794769 |
65 | ok( !$vh->next_version_set, 'VersionHandler is null on next try' ); |
66 | } |
67 | |
68 | done_testing; |
b539a216 |
69 | # vim: ts=2 sw=2 expandtab |