8 'DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions';
10 my $versions = [map "$_.0", 0..100];
13 my $vh = ExplicitVersions->new({
14 ordered_versions => $versions,
15 schema_version => '2.0',
16 database_version => '1.0',
19 ok $vh, 'VersionHandler gets instantiated';
22 eq_array($vh->next_version_set, [qw( 1.0 2.0 )]),
23 'first version pair works'
26 !$vh->next_version_set,
27 'next version set returns undef when we are done'
32 my $vh = ExplicitVersions->new({
33 ordered_versions => $versions,
35 schema_version => '1.0',
36 database_version => '1.0',
39 ok $vh, 'VersionHandler gets instantiated';
42 !$vh->next_version_set,
43 'next version set returns undef if we are at the version requested'
48 my $vh = ExplicitVersions->new({
49 ordered_versions => $versions,
51 schema_version => '1.0',
52 database_version => '1.0',
55 ok $vh, 'VersionHandler gets instantiated';
57 eq_array($vh->next_version_set, [qw( 1.0 2.0 )]),
58 'first version pair works'
61 eq_array($vh->next_version_set, [qw( 2.0 3.0 )]),
62 'second version pair works'
65 eq_array($vh->next_version_set, [qw( 3.0 4.0 )]),
66 'third version pair works'
69 eq_array($vh->next_version_set, [qw( 4.0 5.0 )]),
70 'fourth version pair works'
72 ok( !$vh->next_version_set, 'no more versions after final pair' );
73 ok( !$vh->next_version_set, 'still no more versions after final pair' );
77 my $vh = ExplicitVersions->new({
78 ordered_versions => $versions,
79 schema_version => '2.0',
80 database_version => '1.1',
83 } 'dies if database version not found in ordered_versions';
86 my $vh = ExplicitVersions->new({
87 ordered_versions => $versions,
89 schema_version => '1.0',
90 database_version => '1.0',
92 } 'cannot request a version before the current version';
95 #vim: ts=2 sw=2 expandtab