X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F39load_namespaces_3.t;h=99ad8a952caf262350bfac0e5e4874e73ce65732;hb=2c649fafe996a7ee5b85b229a9ed2128b0e7ee1f;hp=531aa898ee454e7c2d57273b71b333b4137b24bc;hpb=3995895f9e96892ed0f359050b437ccd083724ad;p=dbsrgits%2FDBIx-Class.git diff --git a/t/39load_namespaces_3.t b/t/39load_namespaces_3.t index 531aa89..99ad8a9 100644 --- a/t/39load_namespaces_3.t +++ b/t/39load_namespaces_3.t @@ -1,38 +1,36 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; +use Test::Exception; +use Test::Warn; -unshift(@INC, './t/lib'); - -plan tests => 9; +use lib qw(t/lib); +use DBICTest; # do not remove even though it is not used -my $warnings; -eval { - local $SIG{__WARN__} = sub { $warnings .= shift }; - package DBICNSTestOther; - use base qw/DBIx::Class::Schema/; - __PACKAGE__->load_namespaces( - source_namespace => '+DBICNSTest::Src', - resultset_namespace => '+DBICNSTest::RSet', - result_namespace => '+DBICNSTest::Res' - ); -}; -ok(!$@) or diag $@; -like($warnings, qr/load_namespaces found ResultSet class C with no corresponding source-definition class/); -like($warnings, qr/load_namespaces found Result class C with no corresponding source-definition class/); +lives_ok (sub { + warnings_exist ( sub { + package DBICNSTestOther; + use base qw/DBIx::Class::Schema/; + __PACKAGE__->load_namespaces( + result_namespace => [ '+DBICNSTest::Rslt', '+DBICNSTest::OtherRslt' ], + resultset_namespace => '+DBICNSTest::RSet', + ); + }, + qr/load_namespaces found ResultSet class 'DBICNSTest::RSet::C' with no corresponding Result class/, + ); +}); my $source_a = DBICNSTestOther->source('A'); isa_ok($source_a, 'DBIx::Class::ResultSource::Table'); my $rset_a = DBICNSTestOther->resultset('A'); isa_ok($rset_a, 'DBICNSTest::RSet::A'); -my $resclass_a = DBICNSTestOther->resultset('A')->result_class; -is($resclass_a, 'DBICNSTest::Res::A'); my $source_b = DBICNSTestOther->source('B'); isa_ok($source_b, 'DBIx::Class::ResultSource::Table'); my $rset_b = DBICNSTestOther->resultset('B'); isa_ok($rset_b, 'DBIx::Class::ResultSet'); -my $resclass_b = DBICNSTestOther->resultset('B')->result_class; -is($resclass_b, 'DBICNSTest::Src::B'); + +my $source_d = DBICNSTestOther->source('D'); +isa_ok($source_d, 'DBIx::Class::ResultSource::Table'); + +done_testing;