new config option to DBICTest to let you set an alternative storage type, start on...
[dbsrgits/DBIx-Class.git] / t / 39load_namespaces_3.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6
7 unshift(@INC, './t/lib');
8
9 plan tests => 7;
10
11 my $warnings;
12 eval {
13     local $SIG{__WARN__} = sub { $warnings .= shift };
14     package DBICNSTestOther;
15     use base qw/DBIx::Class::Schema/;
16     __PACKAGE__->load_namespaces(
17         result_namespace => [ '+DBICNSTest::Rslt', '+DBICNSTest::OtherRslt' ],
18         resultset_namespace => '+DBICNSTest::RSet',
19     );
20 };
21 ok(!$@) or diag $@;
22 like($warnings, qr/load_namespaces found ResultSet class C with no corresponding Result class/);
23
24 my $source_a = DBICNSTestOther->source('A');
25 isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
26 my $rset_a   = DBICNSTestOther->resultset('A');
27 isa_ok($rset_a, 'DBICNSTest::RSet::A');
28
29 my $source_b = DBICNSTestOther->source('B');
30 isa_ok($source_b, 'DBIx::Class::ResultSource::Table');
31 my $rset_b   = DBICNSTestOther->resultset('B');
32 isa_ok($rset_b, 'DBIx::Class::ResultSet');
33
34 my $source_d = DBICNSTestOther->source('D');
35 isa_ok($source_d, 'DBIx::Class::ResultSource::Table');