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