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