local *Class::C3::reinitialize = sub { };
use warnings 'redefine';
+ my %done;
foreach my $result (keys %results) {
my $result_class = $results{$result};
$class->ensure_class_loaded($result_class);
my $rs_class = delete $resultsets{$result};
my $rs_set = $result_class->resultset_class;
+ $done{$rs_set} = $rs_set unless exists $done{$rs_set};
if($rs_set && $rs_set ne 'DBIx::Class::ResultSet') {
- if($rs_class && $rs_class ne $rs_set) {
+ if($rs_class && !exists($done{$rs_set}) && $rs_class ne $rs_set) {
warn "We found ResultSet class '$rs_class' for '$result', but it seems "
. "that you had already set '$result' to use '$rs_set' instead";
}
use lib 't/lib';
-plan tests => 2;
+plan tests => 4;
sub _chk_warning {
defined $_[0]?
);
};
ok(!$@) or diag $@;
-ok(_chk_warning($warnings), 'Works here');
+ok(_chk_warning($warnings), 'expected no complaint');
eval {
local $SIG{__WARN__} = sub { $warnings .= shift };
);
};
ok(!$@) or diag $@;
-ok(_chk_warning($warnings), 'Fails here');
+ok(_chk_warning($warnings), 'expected no complaint') or diag $warnings;