add ResultSetManager tests
David Kamholz [Fri, 3 Feb 2006 15:46:32 +0000 (15:46 +0000)]
t/40resultsetmanager.t [new file with mode: 0644]
t/lib/DBICTest/Extra.pm [new file with mode: 0644]
t/lib/DBICTest/Extra/Foo.pm [new file with mode: 0644]

diff --git a/t/40resultsetmanager.t b/t/40resultsetmanager.t
new file mode 100644 (file)
index 0000000..dfac9b6
--- /dev/null
@@ -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 (file)
index 0000000..7e07bc0
--- /dev/null
@@ -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 (file)
index 0000000..c43739f
--- /dev/null
@@ -0,0 +1,6 @@
+package DBICTest::Extra::Foo;
+use base 'DBICTest::Extra::Base';
+
+__PACKAGE__->table('foo');
+
+sub bar : resultset { 'good' }