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