Some cleanups to the m2m warnings test
[dbsrgits/DBIx-Class.git] / t / 63register_class.t
CommitLineData
b9537280 1use strict;
2use warnings;
3
fccc2e87 4use Test::More tests => 3;
b9537280 5use lib qw(t/lib);
6use DBICTest;
7use DBICTest::Schema;
8use DBICTest::Schema::Artist;
9
10DBICTest::Schema::Artist->source_name('MyArtist');
fccc2e87 11{
12 my $w;
13 local $SIG{__WARN__} = sub { $w = shift };
14 DBICTest::Schema->register_class('FooA', 'DBICTest::Schema::Artist');
15 like ($w, qr/use register_extra_source/, 'Complain about using register_class on an already-registered class');
16}
b9537280 17
18my $schema = DBICTest->init_schema();
19
20my $a = $schema->resultset('FooA')->search;
21is($a->count, 3, 'have 3 artists');
22is($schema->class('FooA'), 'DBICTest::FooA', 'Correct artist class');
fccc2e87 23
24# clean up
25DBICTest::Schema->_unregister_source('FooA');