made cdbi-t optional
[dbsrgits/DBIx-Class-Historic.git] / t / cdbi-t / 16-reserved.t
CommitLineData
9bc6db13 1use strict;
2use Test::More;
3
4BEGIN {
289ba852 5 eval "use DBIx::Class::CDBICompat;";
6 if ($@) {
7 plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
8 next;
9 }
10 eval "use DBD::SQLite";
11 plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5);
9bc6db13 12}
13
14use lib 't/testlib';
15require Film;
16require Order;
17
18Film->has_many(orders => 'Order');
19Order->has_a(film => 'Film');
20
21Film->create_test_film;
22
23my $film = Film->retrieve('Bad Taste');
24isa_ok $film => 'Film';
25
26$film->add_to_orders({ orders => 10 });
27
28my $bto = (Order->search(film => 'Bad Taste'))[0];
29isa_ok $bto => 'Order';
30is $bto->orders, 10, "Correct number of orders";
31
32
33my $infilm = $bto->film;
34isa_ok $infilm, "Film";
35
36is $infilm->id, $film->id, "Orders hasa Film";