Massive cleanup of DateTime test dependencies, other interim
[dbsrgits/DBIx-Class.git] / t / cdbi / has_many_loads_foreign_class.t
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   plan tests => 3;
9 }
10
11
12 use lib 't/cdbi/testlib';
13 use Director;
14
15 # Test that has_many() will load the foreign class.
16 ok !Class::Inspector->loaded( 'Film' );
17 ok eval { Director->has_many( films => 'Film' ); 1; } || diag $@;
18
19 my $shan_hua = Director->create({
20     Name    => "Shan Hua",
21 });
22
23 my $inframan = Film->create({
24     Title       => "Inframan",
25     Director    => "Shan Hua",
26 });
27 my $guillotine2 = Film->create({
28     Title       => "Flying Guillotine 2",
29     Director    => "Shan Hua",
30 });
31 my $guillotine = Film->create({
32     Title       => "Master of the Flying Guillotine",
33     Director    => "Yu Wang",
34 });
35
36 is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];