ZOMG use strict and warnings in tests
[dbsrgits/DBIx-Class-DeploymentHandler.git] / t / version_handlers / db_schema_versions.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9 use lib 't/lib';
10 use aliased
11   'DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions';
12
13 {
14   my $vh = DatabaseToSchemaVersions->new({
15     to_version => '5.0',
16     database_version => '1.0',
17     schema_version => '1.0',
18   });
19
20   ok( $vh, 'VersionHandler gets instantiated' );
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   );
25   ok( !$vh->next_version_set, 'next_version_set only works once');
26   ok( !$vh->next_version_set, 'seriously.');
27 }
28
29 {
30   my $vh = DatabaseToSchemaVersions->new({
31     database_version => '1.0',
32     schema_version => '1.0',
33   });
34
35   ok( $vh, 'VersionHandler gets instantiated' );
36   ok(
37     !$vh->next_version_set,
38     'VersionHandler is null when schema_version and db_verison are the same'
39   );
40 }
41
42 {
43   my $vh = DatabaseToSchemaVersions->new({
44     database_version => '1.0',
45     schema_version => '1.0',
46   });
47
48   ok( $vh, 'VersionHandler gets instantiated' );
49   ok(
50     !$vh->next_version_set,
51     'VersionHandler is null when schema_version and db_verison are the same'
52   );
53 }
54
55 {
56   my $vh = DatabaseToSchemaVersions->new({
57     database_version => '1.0',
58     schema_version => '10.0',
59   });
60
61   ok( $vh, 'VersionHandler gets instantiated' );
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   );
66   ok( !$vh->next_version_set, 'VersionHandler is null on next try' );
67 }
68
69 done_testing;
70 # vim: ts=2 sw=2 expandtab