get rid of an empty trailing hashref if appropriate
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 26invoke_classmeth.t
1 use strict;
2 use Test::More tests => 4;
3 use lib qw(t/lib);
4 use make_dbictest_db;
5
6 eval { require DBD::SQLite };
7 my $class = $@ ? 'SQLite2' : 'SQLite';
8
9 use DBIx::Class::Schema::Loader qw/ make_schema_at /;
10
11 make_schema_at(
12     'DBICTest::Schema',
13     { relationships => 1 },
14     [ "dbi:$class:dbname=./t/dbictest.db" ],
15 );
16
17 my $schema_class = 'DBICTest::Schema';
18 my $schema = $schema_class->clone;
19 isa_ok($schema, 'DBIx::Class::Schema');
20
21 my $foo_rs = $schema->resultset('Bar')->search({ barid => 3})->search_related('fooref');
22 isa_ok($foo_rs, 'DBIx::Class::ResultSet');
23
24 my $foo_first = $foo_rs->first;
25 isa_ok($foo_first, 'DBICTest::Schema::Foo');
26
27 my $foo_first_text = $foo_first->footext;
28 is($foo_first_text, 'This is the text of the only Foo record associated with the Bar with barid 3');