11 'DBIx::Class::DeploymentHandler::VersionHandler::Monotonic';
14 my $vh = Monotonic->new({
16 database_version => 1,
19 ok $vh, 'VersionHandler gets instantiated';
22 eq_array($vh->next_version_set, [1,2]),
23 'first version pair works'
26 !$vh->next_version_set,
27 'next version set returns undef when we are done'
32 my $vh = Monotonic->new({
35 database_version => 1,
38 ok $vh, 'VersionHandler gets instantiated';
41 !$vh->next_version_set,
42 'next version set returns undef if we are at the version requested'
47 my $vh = Monotonic->new({
50 database_version => 1,
53 ok $vh, 'VersionHandler gets instantiated';
55 eq_array($vh->next_version_set, [1,2]),
56 'first version pair works'
59 eq_array($vh->next_version_set, [2,3]),
60 'second version pair works'
63 eq_array($vh->next_version_set, [3,4]),
64 'third version pair works'
67 eq_array($vh->next_version_set, [4,5]),
68 'fourth version pair works'
70 ok( !$vh->next_version_set, 'no more versions after final pair' );
71 ok( !$vh->next_version_set, 'still no more versions after final pair' );
75 my $vh = Monotonic->new({
78 database_version => 5,
81 ok $vh, 'VersionHandler gets instantiated';
83 eq_array($vh->previous_version_set, [5,4]),
84 'first version pair works'
87 eq_array($vh->previous_version_set, [4,3]),
88 'second version pair works'
91 eq_array($vh->previous_version_set, [3,2]),
92 'third version pair works'
95 eq_array($vh->previous_version_set, [2,1]),
96 'fourth version pair works'
98 ok( !$vh->previous_version_set, 'no more versions before initial pair' );
99 ok( !$vh->previous_version_set, 'still no more versions before initial pair' );
103 my $vh = Monotonic->new({
105 database_version => '1.1',
107 $vh->next_version_set
108 } 'dies if database version not an Int';
111 my $vh = Monotonic->new({
114 database_version => 1,
116 $vh->next_version_set;
117 } 'cannot request an upgrade version before the current version';
120 my $vh = Monotonic->new({
123 database_version => 1,
125 $vh->previous_version_set;
126 } 'cannot request a downgrade version after the current version';
129 #vim: ts=2 sw=2 expandtab