Fixup SQLA monkeypatch in anticipation of new SQLA version
[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;
10
660cf1be 11is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class');
fac560c2 12ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded');
db29433c 13
fac560c2 14DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A');
db29433c 15
16ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded on SET');
fac560c2 17is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet::A', 'custom resultset class set');
db29433c 18ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded on GET');
fac560c2 19
20my $schema = DBICTest->init_schema;
21my $resultset = $schema->resultset('Artist')->search;
22isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class');
f54428ab 23
24done_testing;