Restore ability to handle underdefined root (t/prefetch/incomplete.t)
[dbsrgits/DBIx-Class.git] / t / 107obj_result_class.t
1 package ResultClassInflator;
2
3 sub new { bless {}, __PACKAGE__ }
4
5 1;
6
7 package main;
8
9 use strict;
10 use warnings;
11
12 use Test::More tests => 6;
13 use Test::Exception;
14 use lib qw(t/lib);
15 use DBICTest;
16
17 my $schema = DBICTest->init_schema();
18
19 my $source = $schema->source('CD');
20
21 lives_ok {
22     $source->result_class('ResultClassInflator');
23     is($source->result_class => 'ResultClassInflator', "result_class gives us back class");
24     is($source->get_component_class('result_class') => 'ResultClassInflator',
25         "and so does get_component_class");
26
27     } 'Result class still works with class';
28 lives_ok {
29     my $obj = ResultClassInflator->new();
30     $source->result_class($obj);
31     is($source->result_class => $obj, "result_class gives us back obj");
32     is($source->get_component_class('result_class') => $obj, "and so does get_component_class");
33     } 'Result class works with object';
34
35 done_testing;