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