From: Ben Tilly Date: Thu, 7 Jul 2011 23:46:55 +0000 (-0700) Subject: Add failing test for feature I want. X-Git-Tag: 0.07011~68 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ba5ae4ce56b509d947899b77d94117ca669c817;hp=1fe6af079ad1ea770c0682962fd9e6991cf72d66;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Add failing test for feature I want. --- 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;