Commit | Line | Data |
9bc6db13 |
1 | use strict; |
2 | use Test::More; |
3 | |
50891152 |
4 | use lib 't/cdbi/testlib'; |
d9bd5195 |
5 | use Film; |
6 | use Order; |
9bc6db13 |
7 | |
8 | Film->has_many(orders => 'Order'); |
9 | Order->has_a(film => 'Film'); |
10 | |
11 | Film->create_test_film; |
12 | |
13 | my $film = Film->retrieve('Bad Taste'); |
14 | isa_ok $film => 'Film'; |
15 | |
16 | $film->add_to_orders({ orders => 10 }); |
17 | |
18 | my $bto = (Order->search(film => 'Bad Taste'))[0]; |
19 | isa_ok $bto => 'Order'; |
20 | is $bto->orders, 10, "Correct number of orders"; |
21 | |
22 | |
23 | my $infilm = $bto->film; |
24 | isa_ok $infilm, "Film"; |
25 | |
26 | is $infilm->id, $film->id, "Orders hasa Film"; |
d9bd5195 |
27 | |
28 | done_testing; |