Require DBICTest.pm in all tests even if it is not needed at all
[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 use lib qw(t/lib);
8 use DBICTest; # do not remove even though it is not used
9
10 plan tests => 7;
11
12 my $warnings;
13 eval {
14     local $SIG{__WARN__} = sub { $warnings .= shift };
15     package DBICNSTestOther;
16     use base qw/DBIx::Class::Schema/;
17     __PACKAGE__->load_namespaces(
18         result_namespace => [ '+DBICNSTest::Rslt', '+DBICNSTest::OtherRslt' ],
19         resultset_namespace => '+DBICNSTest::RSet',
20     );
21 };
22 ok(!$@) or diag $@;
23 like($warnings, qr/load_namespaces found ResultSet class C with no corresponding Result class/);
24
25 my $source_a = DBICNSTestOther->source('A');
26 isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
27 my $rset_a   = DBICNSTestOther->resultset('A');
28 isa_ok($rset_a, 'DBICNSTest::RSet::A');
29
30 my $source_b = DBICNSTestOther->source('B');
31 isa_ok($source_b, 'DBIx::Class::ResultSource::Table');
32 my $rset_b   = DBICNSTestOther->resultset('B');
33 isa_ok($rset_b, 'DBIx::Class::ResultSet');
34
35 my $source_d = DBICNSTestOther->source('D');
36 isa_ok($source_d, 'DBIx::Class::ResultSource::Table');