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