From: Peter Rabbitson Date: Sun, 21 Sep 2008 23:22:23 +0000 (+0000) Subject: Add a test for another expected warning X-Git-Tag: v0.08240~332^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fccc2e8704d69a05df1711b4dd8c235c9a9cc27b;p=dbsrgits%2FDBIx-Class.git Add a test for another expected warning --- diff --git a/t/63register_class.t b/t/63register_class.t index 2fdc07c..513c6d3 100644 --- a/t/63register_class.t +++ b/t/63register_class.t @@ -1,17 +1,25 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 3; use lib qw(t/lib); use DBICTest; use DBICTest::Schema; use DBICTest::Schema::Artist; DBICTest::Schema::Artist->source_name('MyArtist'); -DBICTest::Schema->register_class('FooA', 'DBICTest::Schema::Artist'); +{ + my $w; + local $SIG{__WARN__} = sub { $w = shift }; + DBICTest::Schema->register_class('FooA', 'DBICTest::Schema::Artist'); + like ($w, qr/use register_extra_source/, 'Complain about using register_class on an already-registered class'); +} my $schema = DBICTest->init_schema(); my $a = $schema->resultset('FooA')->search; is($a->count, 3, 'have 3 artists'); is($schema->class('FooA'), 'DBICTest::FooA', 'Correct artist class'); + +# clean up +DBICTest::Schema->_unregister_source('FooA');