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