From: Ben Tilly Date: Sat, 9 Jul 2011 19:24:57 +0000 (-0700) Subject: test for connecting through schema_base_class X-Git-Tag: 0.07011~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14b1bd2bfea5864c6a8d68e54df2d6bc2a9b8723;p=dbsrgits%2FDBIx-Class-Schema-Loader.git test for connecting through schema_base_class Add test for applying schema_base_class to dynamic schemas at 'connection' time. --- diff --git a/t/60schema_base_dispatched.t b/t/60schema_base_dispatched.t new file mode 100644 index 0000000..abba311 --- /dev/null +++ b/t/60schema_base_dispatched.t @@ -0,0 +1,21 @@ +# test that the class in schema_base_class gets used when loading the schema +# by Ben Tilly ( btilly -at| gmail.com ) + +use strict; +use Test::More tests => 1; +use DBIx::Class::Schema::Loader qw(make_schema_at); +use lib 't/lib'; +use make_dbictest_db; + +make_schema_at( + 'DBICTest::Schema::_test_schema_base', + { + really_erase_my_files => 1, + naming => 'current', + use_namespaces => 0, + schema_base_class => 'TestSchemaBaseClass', + }, + [ $make_dbictest_db::dsn ], +); + +ok($TestSchemaBaseClass::test_ok, "Connected using schema_base_class."); diff --git a/t/lib/TestSchemaBaseClass.pm b/t/lib/TestSchemaBaseClass.pm new file mode 100644 index 0000000..82e36dc --- /dev/null +++ b/t/lib/TestSchemaBaseClass.pm @@ -0,0 +1,16 @@ +package TestSchemaBaseClass; +use base DBIx::Class::Schema; + +our $test_ok = 0; + +sub connection { + my ($self, @info) = @_; + + if ($info[0] =~ /^dbi/) { + $test_ok = 1; + } + + return $self->next::method(@info); +} + +1;