More robust behavior of ANFANG.pm, also guard against sitecustomize.pl
[dbsrgits/DBIx-Class.git] / t / 102load_classes.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5 use Test::More;
6
7
8 use DBICTest;
9
10 my $warnings;
11 eval {
12     local $SIG{__WARN__} = sub { $warnings .= shift };
13     package DBICTest::Schema;
14     use base qw/DBIx::Class::Schema/;
15     __PACKAGE__->load_classes;
16 };
17 ok(!$@, 'Loaded all loadable classes') or diag $@;
18 like($warnings, qr/Failed to load DBICTest::Schema::NoSuchClass. Can't find source_name method. Is DBICTest::Schema::NoSuchClass really a full DBIC result class?/, 'Warned about broken result class');
19
20 my $source_a = DBICTest::Schema->source('Artist');
21 isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
22 my $rset_a   = DBICTest::Schema->resultset('Artist');
23 isa_ok($rset_a, 'DBIx::Class::ResultSet');
24
25 done_testing;