[Bast-commits] r4544 - in DBIx-Class/0.08/trunk:
lib/DBIx/Class/Schema t
lukes at dev.catalyst.perl.org
lukes at dev.catalyst.perl.org
Mon Jun 30 21:07:13 BST 2008
Author: lukes
Date: 2008-06-30 21:07:13 +0100 (Mon, 30 Jun 2008)
New Revision: 4544
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm
DBIx-Class/0.08/trunk/t/94versioning.t
Log:
implemented versioning tests for version warns
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm 2008-06-30 18:38:08 UTC (rev 4543)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema/Versioned.pm 2008-06-30 20:07:13 UTC (rev 4544)
@@ -443,7 +443,6 @@
# useful when connecting from scripts etc
return if ($args->{ignore_version} || ($ENV{DBIC_NO_VERSION_CHECK} && !exists $args->{ignore_version}));
-
my $pversion = $self->get_db_version();
if($pversion eq $self->schema_version)
Modified: DBIx-Class/0.08/trunk/t/94versioning.t
===================================================================
--- DBIx-Class/0.08/trunk/t/94versioning.t 2008-06-30 18:38:08 UTC (rev 4543)
+++ DBIx-Class/0.08/trunk/t/94versioning.t 2008-06-30 20:07:13 UTC (rev 4544)
@@ -18,7 +18,7 @@
eval "use DBD::mysql; use SQL::Translator 0.09;";
plan $@
? ( skip_all => 'needs DBD::mysql and SQL::Translator 0.09 for testing' )
- : ( tests => 13 );
+ : ( tests => 17 );
}
my $version_table_name = 'dbix_class_schema_versions';
@@ -88,19 +88,30 @@
{
my $schema_version = DBICVersion::Schema->connect($dsn, $user, $pass);
eval {
- $schema_version->storage->dbh->do("DROP TABLE IF EXISTS $version_table_name");
+ $schema_version->storage->dbh->do("DELETE from $version_table_name");
};
+
+ my $warn = '';
+ $SIG{__WARN__} = sub { $warn = shift };
$schema_version = DBICVersion::Schema->connect($dsn, $user, $pass);
+ like($warn, qr/Your DB is currently unversioned/, 'warning detected without env var or attr');
+
+
# should warn
-
+ $warn = '';
$schema_version = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_version => 1 });
+ is($warn, '', 'warning not detected with attr set');
# should not warn
$ENV{DBIC_NO_VERSION_CHECK} = 1;
+ $warn = '';
$schema_version = DBICVersion::Schema->connect($dsn, $user, $pass);
+ is($warn, '', 'warning not detected with env var set');
# should not warn
+ $warn = '';
$schema_version = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_version => 0 });
+ like($warn, qr/Your DB is currently unversioned/, 'warning detected without env var or attr');
# should warn
}
More information about the Bast-commits
mailing list