X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F39load_namespaces_1.t;h=f7fb08ee2ca39f9190e720e32d8a2fd7e852c904;hb=refs%2Fheads%2Fpeople%2Filmari%2Fhri-prefetch-test;hp=bf7838057988b90820b69cedac8616784a3edf5f;hpb=762deea27e3ebd9abc4045656242a762441fd4df;p=dbsrgits%2FDBIx-Class.git diff --git a/t/39load_namespaces_1.t b/t/39load_namespaces_1.t index bf78380..f7fb08e 100644 --- a/t/39load_namespaces_1.t +++ b/t/39load_namespaces_1.t @@ -1,25 +1,23 @@ -#!/usr/bin/perl +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } use strict; use warnings; use Test::More; -use Test::Warn; -use lib qw(t/lib); + use DBICTest; # do not remove even though it is not used -warnings_exist ( - sub { +my $warnings; +eval { + local $SIG{__WARN__} = sub { $warnings .= shift }; package DBICNSTest; - use base qw/DBIx::Class::Schema/; + use base qw/DBICTest::BaseSchema/; __PACKAGE__->load_namespaces; - }, - [ - qr/load_namespaces found ResultSet class C with no corresponding Result class/, - qr/load_namespaces found ResultSet class DBICNSTest::ResultSet::D that does not subclass DBIx::Class::ResultSet/, - ], - 'Found warning about extra ResultSet classes, and incorrectly subclassed ResultSets', -); +}; +ok(!$@, 'load_namespaces doesnt die') or diag $@; +like($warnings, qr/load_namespaces found ResultSet class 'DBICNSTest::ResultSet::C' with no corresponding Result class/, 'Found warning about extra ResultSet classes'); + +like($warnings, qr/load_namespaces found ResultSet class 'DBICNSTest::ResultSet::D' that does not subclass DBIx::Class::ResultSet/, 'Found warning about ResultSets with incorrect subclass'); my $source_a = DBICNSTest->source('A'); isa_ok($source_a, 'DBIx::Class::ResultSource::Table');