From: John Napiorkowski Date: Fri, 17 Feb 2012 16:49:17 +0000 (-0500) Subject: change all the tests to use the new test schema namespace X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=606558576b9c849f4b2a68c9d0709a3ef61e477a;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git change all the tests to use the new test schema namespace --- diff --git a/t/02-instantiation-no-ddl.t b/t/02-instantiation-no-ddl.t index b892f2c..02d4f7d 100644 --- a/t/02-instantiation-no-ddl.t +++ b/t/02-instantiation-no-ddl.t @@ -21,8 +21,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({ ignore_ddl => 1, @@ -55,8 +55,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({ ignore_ddl => 1, @@ -69,6 +69,7 @@ VERSION2: { my $version = $s->schema_version(); $handler->prepare_install; +#$handler->prepare_upgrade({ from_version => 1, to_version => 2 }); dies_ok { $s->resultset('Foo')->create({ bar => 'frew', @@ -92,8 +93,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({ ignore_ddl => 1, @@ -125,8 +126,8 @@ VERSION3: { DOWN2: { use_ok 'DBICVersion_v4'; - my $s = DBICVersion::Schema->connect(@connection); - $DBICVersion::Schema::VERSION = 2; + my $s = DBICVersion::Schema4->connect(@connection); + $DBICVersion::Schema4::VERSION = 2; ok($s, 'DBICVersion::Schema 2 instantiates correctly'); my $handler = DH->new({ ignore_ddl => 1, @@ -142,7 +143,6 @@ DOWN2: { $s->resultset('Foo')->create({ bar => 'frew', baz => 'frew', - biff => 'frew', }) } 'schema at version 3'; $handler->downgrade; diff --git a/t/03-deprecated.t b/t/03-deprecated.t index f29244a..96d2d6d 100644 --- a/t/03-deprecated.t +++ b/t/03-deprecated.t @@ -19,7 +19,7 @@ my $sql_dir = 't/sql'; VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema1->connect(@connection); is $s->schema_version, '1.0', 'schema version is at 1.0'; ok($s, 'DBICVersion::Schema 1.0 instantiates correctly'); my $handler = Deprecated->new({ @@ -52,7 +52,7 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema2->connect(@connection); is $s->schema_version, '2.0', 'schema version is at 2.0'; ok($s, 'DBICVersion::Schema 2.0 instantiates correctly'); my $handler = Deprecated->new({ @@ -89,7 +89,7 @@ VERSION2: { VERSION3: { use_ok 'DBICVersion_v3'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema3->connect(@connection); is $s->schema_version, '3.0', 'schema version is at 3.0'; ok($s, 'DBICVersion::Schema 3.0 instantiates correctly'); my $handler = Deprecated->new({ diff --git a/t/04-preconnect.t b/t/04-preconnect.t index 9d9cded..9a0a04a 100644 --- a/t/04-preconnect.t +++ b/t/04-preconnect.t @@ -20,7 +20,7 @@ my $sql_dir = 't/sql'; VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema1->connect(@connection); $DBICVersion::Schema::VERSION = 1; ok($s, 'DBICVersion::Schema 1 instantiates correctly'); ok !$s->storage->connected, 'creating schema did not connect'; diff --git a/t/bugs/01-emailed-bug-01.t b/t/bugs/01-emailed-bug-01.t index dca69b9..8e65db4 100644 --- a/t/bugs/01-emailed-bug-01.t +++ b/t/bugs/01-emailed-bug-01.t @@ -19,8 +19,8 @@ my @connection = (sub { $dbh }, { ignore_version => 1 }); my $sql_dir = 't/sql'; 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 $dh = DH->new({ diff --git a/t/deploy_methods/sql_translator.t b/t/deploy_methods/sql_translator.t index 62094d9..614c6c0 100644 --- a/t/deploy_methods/sql_translator.t +++ b/t/deploy_methods/sql_translator.t @@ -37,7 +37,7 @@ for (qw(initialize upgrade downgrade deploy)) { VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema1->connect(@connection); my $dm = Translator->new({ schema => $s, script_directory => $sql_dir, @@ -82,7 +82,7 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema2->connect(@connection); my $dm = Translator->new({ schema => $s, script_directory => $sql_dir, @@ -189,7 +189,7 @@ VERSION2: { VERSION3: { use_ok 'DBICVersion_v3'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema3->connect(@connection); my $dm = Translator->new({ schema => $s, script_directory => $sql_dir, @@ -256,9 +256,12 @@ VERSION3: { biff => 'frew', }) } 'schema is deployed'; - dies_ok { - $dm->upgrade_single_step({ version_set => [qw( 2.0 3.0 )] }); - } 'dies when sql dir does not exist'; + ## This doesn't die now with the SQLT fixes + #dies_ok { + # $dm->upgrade_single_step({ version_set => [qw( 2.0 3.0 )] }); + #} 'dies when sql dir does not exist'; + # + $dm->upgrade_single_step({ version_set => [qw( 2.0 3.0 )] }); } my $stuff_that_ran = do { local( @ARGV, $/ ) = 'stuffthatran'; <> }; diff --git a/t/deploy_methods/sql_translator_deprecated.t b/t/deploy_methods/sql_translator_deprecated.t index 709fcd0..768b514 100644 --- a/t/deploy_methods/sql_translator_deprecated.t +++ b/t/deploy_methods/sql_translator_deprecated.t @@ -18,7 +18,7 @@ DBICDHTest::ready; VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema1->connect(@connection); my $dm = Deprecated->new({ schema => $s, script_directory => $sql_dir, @@ -31,7 +31,7 @@ VERSION1: { $dm->prepare_deploy; ok( - -f catfile(qw( t sql DBICVersion-Schema-1.0-SQLite.sql )), + -f catfile(qw( t sql DBICVersion-Schema1-1.0-SQLite.sql )), '1.0 schema gets generated properly' ); @@ -50,7 +50,7 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema2->connect(@connection); my $dm = Deprecated->new({ schema => $s, script_directory => $sql_dir, diff --git a/t/deploy_methods/sql_translator_protoschema_transform.t b/t/deploy_methods/sql_translator_protoschema_transform.t index d0ce6cf..a37aab5 100644 --- a/t/deploy_methods/sql_translator_protoschema_transform.t +++ b/t/deploy_methods/sql_translator_protoschema_transform.t @@ -20,7 +20,7 @@ DBICDHTest::ready; VERSION1: { use_ok 'DBICVersion_v1'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema1->connect(@connection); my $dm = Translator->new({ schema => $s, script_directory => $sql_dir, @@ -34,7 +34,7 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - my $s = DBICVersion::Schema->connect(@connection); + my $s = DBICVersion::Schema2->connect(@connection); my $dm = Translator->new({ schema => $s, script_directory => $sql_dir, diff --git a/t/mysql/basic.t b/t/mysql/basic.t index 7ace92a..0c17031 100644 --- a/t/mysql/basic.t +++ b/t/mysql/basic.t @@ -20,8 +20,8 @@ VERSION1: { my $dbh = DBI->connect("DBI:mysql:test;mysql_socket=${\$testdb->base_dir}/tmp/mysql.sock",'root',''); use_ok 'DBICVersion_v1'; - $DBICVersion::Schema::VERSION = 1; - ok my $schema = DBICVersion::Schema->connect(sub { $dbh }), + $DBICVersion::Schema1::VERSION = 1; + ok my $schema = DBICVersion::Schema1->connect(sub { $dbh }), 'got schema'; ok my $dbic_dh = build_dh($schema), @@ -40,8 +40,8 @@ VERSION2: { my $dbh = DBI->connect("DBI:mysql:test;mysql_socket=${\$testdb->base_dir}/tmp/mysql.sock",'root',''); use_ok 'DBICVersion_v2'; - $DBICVersion::Schema::VERSION = 2; - ok my $schema = DBICVersion::Schema->connect(sub { $dbh }), + $DBICVersion::Schema2::VERSION = 2; + ok my $schema = DBICVersion::Schema2->connect(sub { $dbh }), 'got schema'; ok my $dbic_dh = build_dh($schema,1), @@ -69,8 +69,8 @@ VERSION1FORCE: { my $dbh = DBI->connect("DBI:mysql:test;mysql_socket=${\$testdb->base_dir}/tmp/mysql.sock",'root',''); use_ok 'DBICVersion_v2'; - $DBICVersion::Schema::VERSION = 2; - ok my $schema = DBICVersion::Schema->connect(sub { $dbh }), + $DBICVersion::Schema2::VERSION = 2; + ok my $schema = DBICVersion::Schema2->connect(sub { $dbh }), 'got schema'; my $dbic_dh = DBIx::Class::DeploymentHandler->new({ diff --git a/t/postgresql/basic.t b/t/postgresql/basic.t index af580ba..47a0238 100644 --- a/t/postgresql/basic.t +++ b/t/postgresql/basic.t @@ -19,8 +19,8 @@ my $dbh = DBI->connect("DBI:Pg:dbname=test;host=127.0.0.1;port=${\$testdb->port} VERSION1: { use_ok 'DBICVersion_v1'; - $DBICVersion::Schema::VERSION = 1; - ok my $schema = DBICVersion::Schema->connect(sub { $dbh }), + $DBICVersion::Schema1::VERSION = 1; + ok my $schema = DBICVersion::Schema1->connect(sub { $dbh }), 'got schema'; ok my $dbic_dh = build_dh($schema), @@ -35,8 +35,8 @@ VERSION1: { VERSION2: { use_ok 'DBICVersion_v2'; - $DBICVersion::Schema::VERSION = 2; - ok my $schema = DBICVersion::Schema->connect(sub { $dbh }), + $DBICVersion::Schema2::VERSION = 2; + ok my $schema = DBICVersion::Schema2->connect(sub { $dbh }), 'got schema'; ok my $dbic_dh = build_dh($schema,1), @@ -78,7 +78,7 @@ sub make_perl_runfile { my $perl_run, ">", catfile('t','share','var','pg-deploy','PostgreSQL', 'deploy', '1', '002-test.pl') - ) || die "Cannot open: $!"; + ) || do { $testdb->stop(POSIX::SIGINT); die "Cannot open: $!"}; print $perl_run <<'END'; sub { diff --git a/t/version_storages/standard.t b/t/version_storages/standard.t index 01bdb0e..cc1681d 100644 --- a/t/version_storages/standard.t +++ b/t/version_storages/standard.t @@ -17,11 +17,11 @@ my $dbh = DBICDHTest::dbh(); my @connection = (sub { $dbh }, { ignore_version => 1 }); my $sql_dir = 't/sql'; -my $s = DBICVersion::Schema->connect(@connection); +my $s = DBICVersion::Schema1->connect(@connection); { my $warning; local $SIG{__WARN__} = sub {$warning = shift}; - my $t = DBICVersion::Schema->connect('frewfrew', '', ''); + my $t = DBICVersion::Schema1->connect('frewfrew', '', ''); like( $warning, qr/Your DB is currently unversioned. Please call upgrade on your schema to sync the DB/, 'warning when database is unversioned'); } @@ -82,7 +82,7 @@ my $u; { my $warning; local $SIG{__WARN__} = sub {$warning = shift}; - $u = DBICVersion::Schema->connect(sub { $dbh }); + $u = DBICVersion::Schema1->connect(sub { $dbh }); like( $warning, qr/Versions out of sync. This is 1\.0, your database contains version 2\.0, please call upgrade on your Schema\./, 'warning when database/schema mismatch'); }