X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fresultset_class.t;h=3d79022392a1f24a14dd40f92ae2e9ef7dd6e712;hb=ea3ee77d2d9e137b07ca4b2db14986e8310f4bec;hp=078c57b9515fb068d4280952df0f6330e154f8d3;hpb=fac560c2bcc31d5ab5f981abc521a41501cb1e8a;p=dbsrgits%2FDBIx-Class.git diff --git a/t/resultset_class.t b/t/resultset_class.t index 078c57b..3d79022 100644 --- a/t/resultset_class.t +++ b/t/resultset_class.t @@ -1,22 +1,23 @@ -#!/usr/bin/perl +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } use strict; use warnings; use Test::More; -use Class::Inspector (); - -unshift(@INC, './t/lib'); -use lib 't/lib'; -plan tests => 5; use DBICTest; +use DBICTest::Util 'class_seems_loaded'; + +is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICTest::BaseResultSet', 'default resultset class'); +ok(! class_seems_loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded'); -is(DBICTest::Schema->source('Artist')->resultset_class, 'DBIx::Class::ResultSet', 'default resultset class'); -ok(!Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded'); DBICTest::Schema->source('Artist')->resultset_class('DBICNSTest::ResultSet::A'); -ok(Class::Inspector->loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded automatically'); + +ok(! class_seems_loaded('DBICNSTest::ResultSet::A'), 'custom resultset class not loaded on SET'); is(DBICTest::Schema->source('Artist')->resultset_class, 'DBICNSTest::ResultSet::A', 'custom resultset class set'); +ok(class_seems_loaded('DBICNSTest::ResultSet::A'), 'custom resultset class loaded on GET'); my $schema = DBICTest->init_schema; my $resultset = $schema->resultset('Artist')->search; isa_ok($resultset, 'DBICNSTest::ResultSet::A', 'resultset is custom class'); + +done_testing;