get rid of an empty trailing hashref if appropriate
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 24invoke_normal.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 package DBICTest::Schema;
10 use base qw/ DBIx::Class::Schema::Loader /;
11
12 __PACKAGE__->loader_options( relationships => 1 );
13
14 package main;
15
16 my $schema_class = 'DBICTest::Schema';
17 my $schema = $schema_class->connect("dbi:$class:dbname=./t/dbictest.db");
18 isa_ok($schema, 'DBIx::Class::Schema');
19
20 my $foo_rs = $schema->resultset('Bar')->search({ barid => 3})->search_related('fooref');
21 isa_ok($foo_rs, 'DBIx::Class::ResultSet');
22
23 my $foo_first = $foo_rs->next;
24 isa_ok($foo_first, 'DBICTest::Schema::Foo');
25
26 my $foo_first_text = $foo_first->footext;
27 is($foo_first_text, 'This is the text of the only Foo record associated with the Bar with barid 3');