File: db_schema_versions.t

package info (click to toggle)
libdbix-class-deploymenthandler-perl 0.002218-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 464 kB
  • ctags: 149
  • sloc: perl: 3,253; makefile: 2
file content (69 lines) | stat: -rw-r--r-- 1,570 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!perl

use strict;
use warnings;

use Test::More;

use lib 't/lib';
use aliased
  'DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions';

{
  my $vh = DatabaseToSchemaVersions->new({
    to_version => '5.0',
    database_version => '1.0',
    schema_version => '1.0',
  });

  ok( $vh, 'VersionHandler gets instantiated' );
  ok(
    eq_array( $vh->next_version_set, [qw( 1.0 5.0 )] ),
    'db version and to_version get correctly put into version set'
  );
  ok( !$vh->next_version_set, 'next_version_set only works once');
  ok( !$vh->next_version_set, 'seriously.');
}

{
  my $vh = DatabaseToSchemaVersions->new({
    database_version => '1.0',
    schema_version => '1.0',
  });

  ok( $vh, 'VersionHandler gets instantiated' );
  ok(
    !$vh->next_version_set,
    'VersionHandler is null when schema_version and db_verison are the same'
  );
}

{
  my $vh = DatabaseToSchemaVersions->new({
    database_version => '1.0',
    schema_version => '1.0',
  });

  ok( $vh, 'VersionHandler gets instantiated' );
  ok(
    !$vh->next_version_set,
    'VersionHandler is null when schema_version and db_verison are the same'
  );
}

{
  my $vh = DatabaseToSchemaVersions->new({
    database_version => '1.0',
    schema_version => '10.0',
  });

  ok( $vh, 'VersionHandler gets instantiated' );
  ok(
    eq_array( $vh->next_version_set, [qw( 1.0 10.0 )] ),
    'db version and schema version get correctly put into version set'
  );
  ok( !$vh->next_version_set, 'VersionHandler is null on next try' );
}

done_testing;
# vim: ts=2 sw=2 expandtab