Restore ability to handle underdefined root (t/prefetch/incomplete.t)
[dbsrgits/DBIx-Class.git] / t / resultset_class.t
1 use strict;
2 use warnings;
3 use Test::More;
4 use Class::Inspector ();
5
6 unshift(@INC, './t/lib');
7 use lib 't/lib';
8
9 use DBICTest;
10
11 is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class');
12 ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded');
13
14 DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A');
15
16 ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded on SET');
17 is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet::A', 'custom resultset class set');
18 ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded on GET');
19
20 my $schema = DBICTest->init_schema;
21 my $resultset = $schema->resultset('Artist')->search;
22 isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class');
23
24 done_testing;