From: David Kamholz Date: Fri, 3 Feb 2006 15:46:32 +0000 (+0000) Subject: add ResultSetManager tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=762a7bb2be8c357381bbcb2b179443b3d519ba4e;p=dbsrgits%2FDBIx-Class-Historic.git add ResultSetManager tests --- diff --git a/t/40resultsetmanager.t b/t/40resultsetmanager.t new file mode 100644 index 0000000..dfac9b6 --- /dev/null +++ b/t/40resultsetmanager.t @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More; + +use lib qw(t/lib); +use DBICTest::Extra; + +plan tests => 4; + +my $schema = DBICTest::Extra->compose_connection('DB', 'foo'); +my $rs = $schema->resultset('Foo'); + +ok( !DB::Foo->can('bar'), 'Foo class does not have bar method' ); +ok( $rs->can('bar'), 'Foo resultset class has bar method' ); +isa_ok( $rs, 'DBICTest::Extra::Foo::_resultset', 'Foo resultset class is correct' ); +is( $rs->bar, 'good', 'bar method works' ); \ No newline at end of file diff --git a/t/lib/DBICTest/Extra.pm b/t/lib/DBICTest/Extra.pm new file mode 100644 index 0000000..7e07bc0 --- /dev/null +++ b/t/lib/DBICTest/Extra.pm @@ -0,0 +1,11 @@ +package DBICTest::Extra::Base; +use base 'DBIx::Class'; + +__PACKAGE__->load_components(qw/ ResultSetManager Core /); + +package DBICTest::Extra; +use base 'DBIx::Class::Schema'; + +__PACKAGE__->load_classes; + +1; \ No newline at end of file diff --git a/t/lib/DBICTest/Extra/Foo.pm b/t/lib/DBICTest/Extra/Foo.pm new file mode 100644 index 0000000..c43739f --- /dev/null +++ b/t/lib/DBICTest/Extra/Foo.pm @@ -0,0 +1,6 @@ +package DBICTest::Extra::Foo; +use base 'DBICTest::Extra::Base'; + +__PACKAGE__->table('foo'); + +sub bar : resultset { 'good' }