Changes/author for a1e1a51
[dbsrgits/DBIx-Class.git] / t / 100extra_source.t
index ac92209..05d99b9 100644 (file)
@@ -12,7 +12,7 @@ use DBICTest;
     use base qw/DBIx::Class::ResultSource::Table/;
 }
 
-plan tests => 3;
+plan tests => 4;
 
 my $schema = DBICTest->init_schema();
 my $artist_source = $schema->source('Artist');
@@ -26,7 +26,7 @@ my $new_source = DBICTest::ResultSource::OtherSource->new({
 $new_source->add_column('other_col' => { data_type => 'integer', default_value => 1 });
 
 my $warn = '';
-$SIG{__WARN__} = sub { $warn = shift };
+local $SIG{__WARN__} = sub { $warn = shift };
 
 {
   $schema->register_extra_source( 'artist->extra' => $new_source );
@@ -36,6 +36,12 @@ $SIG{__WARN__} = sub { $warn = shift };
 }
 
 {
+  my $source = $schema->source('DBICTest::Artist');
+  $schema->register_source($source->source_name, $source);
+  is($warn, '', "re-registering an existing source under the same name causes no errors");
+}
+
+{
   my $new_source_name = 'Artist->preview(artist_preview)';
   $schema->register_source( $new_source_name => $new_source );