X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F39load_namespaces_1.t;h=5798518270a7616994de78dac95822efc2853b1f;hb=5f7ac523d6179423620e5d20a83d3245a2f29385;hp=bd7037014dc8e92b852d41f942114e30b118eb1d;hpb=3995895f9e96892ed0f359050b437ccd083724ad;p=dbsrgits%2FDBIx-Class.git diff --git a/t/39load_namespaces_1.t b/t/39load_namespaces_1.t index bd70370..5798518 100644 --- a/t/39load_namespaces_1.t +++ b/t/39load_namespaces_1.t @@ -4,9 +4,8 @@ use strict; use warnings; use Test::More; -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 { @@ -15,20 +14,24 @@ eval { use base qw/DBIx::Class::Schema/; __PACKAGE__->load_namespaces; }; -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/); +ok(!$@, 'load_namespaces doesnt die') or diag $@; +like($warnings, qr/load_namespaces found ResultSet class 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'); my $rset_a = DBICNSTest->resultset('A'); isa_ok($rset_a, 'DBICNSTest::ResultSet::A'); -my $resclass_a = DBICNSTest->resultset('A')->result_class; -is($resclass_a, 'DBICNSTest::Result::A'); my $source_b = DBICNSTest->source('B'); isa_ok($source_b, 'DBIx::Class::ResultSource::Table'); my $rset_b = DBICNSTest->resultset('B'); isa_ok($rset_b, 'DBIx::Class::ResultSet'); -my $resclass_b = DBICNSTest->resultset('B')->result_class; -is($resclass_b, 'DBICNSTest::Source::B'); + +for my $moniker (qw/A B/) { + my $class = "DBICNSTest::Result::$moniker"; + ok(!defined($class->result_source_instance->source_name), "Source name of $moniker not defined"); +} + +done_testing;