Make the hash-key warning dependent on DBIC_CDBICOMPAT_HASH_WARN because
[dbsrgits/DBIx-Class.git] / t / cdbi-t / columns_as_hashes.t
index 5a5811f..4e39cb7 100644 (file)
@@ -7,7 +7,7 @@ use Test::Warn;
 BEGIN {
   eval "use DBIx::Class::CDBICompat;";
   plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
-          : (tests=> 8);
+          : (tests=> 9);
 }
 
 use lib 't/testlib';
@@ -19,6 +19,8 @@ my $waves = Film->insert({
     Rating    => 'R'
 });
 
+local $ENV{DBIC_CDBICOMPAT_HASH_WARN} = 1;
+
 warnings_like {
     my $rating = $waves->{rating};
     $waves->Rating("PG");
@@ -43,3 +45,9 @@ warnings_like {
 $waves->update;
 my @films = Film->search( Rating => "PG", Title => "Breaking the Waves" );
 is @films, 1, "column updated as hash was saved";
+
+
+warning_is {
+    local $ENV{DBIC_CDBICOMPAT_HASH_WARN} = 0;
+    $waves->{rating}
+} '', 'DBIC_CDBICOMPAT_HASH_WARN controls warnings';
\ No newline at end of file