X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F63register_class.t;h=513c6d3bb9083c98cecf68a801021aa109c22021;hb=d02304e1625bc11507c7df7fa8bc5c430962eceb;hp=2fdc07cf163b288868527441bf3aff7abdf7abf9;hpb=b9537280fd9a38dc4856a286b1920dfc16978b11;p=dbsrgits%2FDBIx-Class-Historic.git 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');