Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / resultset_class.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use Class::Inspector ();
7
8 use DBICTest;
9
10 is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class');
11 ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded');
12
13 DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A');
14
15 ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded on SET');
16 is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet::A', 'custom resultset class set');
17 ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded on GET');
18
19 my $schema = DBICTest->init_schema;
20 my $resultset = $schema->resultset('Artist')->search;
21 isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class');
22
23 done_testing;