Only load DBICTest::Schema when needed in tests
[dbsrgits/DBIx-Class.git] / t / resultset_class.t
CommitLineData
fac560c2 1use strict;
2use warnings;
3use Test::More;
4use Class::Inspector ();
5
6unshift(@INC, './t/lib');
7use lib 't/lib';
fac560c2 8
9use DBICTest;
2c2bc4e5 10use DBICTest::Schema;
fac560c2 11
660cf1be 12is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class');
fac560c2 13ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded');
db29433c 14
fac560c2 15DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A');
db29433c 16
17ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded on SET');
fac560c2 18is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet::A', 'custom resultset class set');
db29433c 19ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded on GET');
fac560c2 20
21my $schema = DBICTest->init_schema;
22my $resultset = $schema->resultset('Artist')->search;
23isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class');
f54428ab 24
25done_testing;