Commit | Line | Data |
4656f62f |
1 | use strict; |
4a233f30 |
2 | use warnings; |
4656f62f |
3 | use Test::More; |
db29433c |
4 | use Class::Inspector (); |
4656f62f |
5 | |
4656f62f |
6 | |
50891152 |
7 | use lib 't/cdbi/testlib'; |
4656f62f |
8 | use Director; |
9 | |
10 | # Test that has_many() will load the foreign class. |
11 | ok !Class::Inspector->loaded( 'Film' ); |
12 | ok eval { Director->has_many( films => 'Film' ); 1; } || diag $@; |
13 | |
14 | my $shan_hua = Director->create({ |
15 | Name => "Shan Hua", |
16 | }); |
17 | |
18 | my $inframan = Film->create({ |
19 | Title => "Inframan", |
20 | Director => "Shan Hua", |
21 | }); |
22 | my $guillotine2 = Film->create({ |
23 | Title => "Flying Guillotine 2", |
24 | Director => "Shan Hua", |
25 | }); |
26 | my $guillotine = Film->create({ |
27 | Title => "Master of the Flying Guillotine", |
28 | Director => "Yu Wang", |
29 | }); |
30 | |
d9bd5195 |
31 | is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2]; |
32 | |
33 | done_testing; |