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