From: Arthur Axel 'fREW' Schmidt Date: Thu, 16 Feb 2012 02:59:04 +0000 (-0600) Subject: how did I miss this? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cdb45dee99a52a37f6e61bfbec2e4af8f3a59f51;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git how did I miss this? --- diff --git a/t/02-instantiation.t b/t/02-instantiation.t index 69ad089..7a2753a 100644 --- a/t/02-instantiation.t +++ b/t/02-instantiation.t @@ -20,8 +20,8 @@ my $sql_dir = 't/sql'; VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect(@connection); - $DBICVersion::Schema::VERSION = 1; + my $s = DBICVersion::Schema1->connect(@connection); + $DBICVersion::Schema1::VERSION = 1; ok($s, 'DBICVersion::Schema 1 instantiates correctly'); my $handler = DH->new({ script_directory => $sql_dir, @@ -53,8 +53,8 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect(@connection); - $DBICVersion::Schema::VERSION = 2; + my $s = DBICVersion::Schema2->connect(@connection); + $DBICVersion::Schema2::VERSION = 2; ok($s, 'DBICVersion::Schema 2 instantiates correctly'); my $handler = DH->new({ script_directory => $sql_dir, @@ -90,8 +90,8 @@ VERSION2: { VERSION3: { use_ok 'DBICVersion_v3'; - my $s = DBICVersion::Schema->connect(@connection); - $DBICVersion::Schema::VERSION = 3; + my $s = DBICVersion::Schema3->connect(@connection); + $DBICVersion::Schema3::VERSION = 3; ok($s, 'DBICVersion::Schema 3 instantiates correctly'); my $handler = DH->new({ script_directory => $sql_dir, @@ -123,21 +123,22 @@ VERSION3: { DOWN2: { use_ok 'DBICVersion_v4'; - my $s = DBICVersion::Schema->connect(@connection); - $DBICVersion::Schema::VERSION = 2; - ok($s, 'DBICVersion::Schema 2 instantiates correctly'); + my $s_old = DBICVersion::Schema3->connect(@connection); + my $s_new = DBICVersion::Schema4->connect(@connection); + $DBICVersion::Schema4::VERSION = 2; + ok($s_new, 'DBICVersion::Schema 2 instantiates correctly'); my $handler = DH->new({ script_directory => $sql_dir, - schema => $s, + schema => $s_new, databases => 'SQLite', }); ok($handler, 'DBIx::Class::DeploymentHandler w/2 instantiates correctly'); - my $version = $s->schema_version(); + my $version = $s_new->schema_version(); $handler->prepare_downgrade({ from_version => 3, to_version => $version }); lives_ok { - $s->resultset('Foo')->create({ + $s_old->resultset('Foo')->create({ bar => 'frew', baz => 'frew', biff => 'frew', @@ -145,14 +146,14 @@ DOWN2: { } 'schema at version 3'; $handler->downgrade; dies_ok { - $s->resultset('Foo')->create({ + $s_old->resultset('Foo')->create({ bar => 'frew', baz => 'frew', biff => 'frew', }) } 'schema not at version 3'; lives_ok { - $s->resultset('Foo')->create({ + $s_new->resultset('Foo')->create({ bar => 'frew', baz => 'frew', }) diff --git a/t/lib/DBICVersion_v1.pm b/t/lib/DBICVersion_v1.pm index 2eee7af..3ceb805 100644 --- a/t/lib/DBICVersion_v1.pm +++ b/t/lib/DBICVersion_v1.pm @@ -1,4 +1,4 @@ -package DBICVersion::Foo; +package DBICVersion::Foo1; use base 'DBIx::Class::Core'; use strict; @@ -19,14 +19,14 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('foo'); -package DBICVersion::Schema; +package DBICVersion::Schema1; use base 'DBIx::Class::Schema'; use strict; use warnings; our $VERSION = '1.0'; -__PACKAGE__->register_class('Foo', 'DBICVersion::Foo'); +__PACKAGE__->register_class('Foo', 'DBICVersion::Foo1'); __PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component'); 1; diff --git a/t/lib/DBICVersion_v2.pm b/t/lib/DBICVersion_v2.pm index 602a1c3..43ac967 100644 --- a/t/lib/DBICVersion_v2.pm +++ b/t/lib/DBICVersion_v2.pm @@ -1,4 +1,4 @@ -package DBICVersion::Foo; +package DBICVersion::Foo2; use base 'DBIx::Class::Core'; use strict; @@ -7,31 +7,36 @@ use warnings; __PACKAGE__->table('Foo'); __PACKAGE__->add_columns( - foo => { - data_type => 'INTEGER', - is_auto_increment => 1, - }, - bar => { - data_type => 'VARCHAR', - size => '10' - }, - baz => { - data_type => 'VARCHAR', - size => '10', - is_nullable => 1, - }, + foo => { + data_type => 'INTEGER', + is_auto_increment => 1, + }, + bar => { + data_type => 'VARCHAR', + size => '10' + }, + baz => { + data_type => 'VARCHAR', + size => '10', + is_nullable => 1, + }, + doomed => { + data_type => 'VARCHAR', + size => '10', + is_nullable => 1, + }, ); __PACKAGE__->set_primary_key('foo'); -package DBICVersion::Schema; +package DBICVersion::Schema2; use base 'DBIx::Class::Schema'; use strict; use warnings; our $VERSION = '2.0'; -__PACKAGE__->register_class('Foo', 'DBICVersion::Foo'); +__PACKAGE__->register_class('Foo', 'DBICVersion::Foo2'); __PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component'); 1; diff --git a/t/lib/DBICVersion_v3.pm b/t/lib/DBICVersion_v3.pm index e7a94ea..1e6cadb 100644 --- a/t/lib/DBICVersion_v3.pm +++ b/t/lib/DBICVersion_v3.pm @@ -1,4 +1,4 @@ -package DBICVersion::Foo; +package DBICVersion::Foo3; use base 'DBIx::Class::Core'; use strict; @@ -29,14 +29,14 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('foo'); -package DBICVersion::Schema; +package DBICVersion::Schema3; use base 'DBIx::Class::Schema'; use strict; use warnings; our $VERSION = '3.0'; -__PACKAGE__->register_class('Foo', 'DBICVersion::Foo'); +__PACKAGE__->register_class('Foo', 'DBICVersion::Foo3'); __PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component'); 1; diff --git a/t/lib/DBICVersion_v4.pm b/t/lib/DBICVersion_v4.pm index 602a1c3..c8b2abb 100644 --- a/t/lib/DBICVersion_v4.pm +++ b/t/lib/DBICVersion_v4.pm @@ -1,4 +1,4 @@ -package DBICVersion::Foo; +package DBICVersion::Foo4; use base 'DBIx::Class::Core'; use strict; @@ -24,14 +24,14 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('foo'); -package DBICVersion::Schema; +package DBICVersion::Schema4; use base 'DBIx::Class::Schema'; use strict; use warnings; our $VERSION = '2.0'; -__PACKAGE__->register_class('Foo', 'DBICVersion::Foo'); +__PACKAGE__->register_class('Foo', 'DBICVersion::Foo4'); __PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component'); 1;